WHY TLE?

Revision en1, by Ssaranshh13, 2022-06-10 01:02:53

I have written the code to solve 1609C - Complex Market Analysis problem, but it gives TLE. I think the complexity of my soln. is O(n*log(log(n) because of Seive rest of the work i have done in linear time. My approach is as follows:

Suppose arr[i] is prime I have calculated the number of chains of 1 on left of arr[i] and similarly on right of arr[i]. Then i have used sum+=onesLeft[i]+onesRight[i]+onesLeft[i]*onesRight[i]; to get the answer.

Here is my submission ----> https://codeforces.net/contest/1609/submission/160055418. Please tell where I am wrong in calculating the time complexity? Thanks in advance.

Tags dp

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Ssaranshh13 2022-06-10 01:02:53 616 Initial revision (published)