Getting AC instead of TLE :o

http://codeforces.com/contest/385/submission/18023084

How this code went for AC where the sieve function running for n=1e7 ?

Can’t understand.Please help.Thanks in advance :slight_smile:

Refer to this link.

10^9 simple operations can be executed within 2 second in Codeforces.

Is that for only codeforces ?

@shubhambhattar

@biprotip

In Codechef, 1 secs is normally around 3∗10^8.
Refer to the last line in the last paragraph of Time Complexity in this link

Is it also works in real onsite contests ?

Can’t comment on this. It should depend on the configuration of the judge machine.

Thanks a lot :slight_smile:

You are welcome.