xQConqueror's blog

By xQConqueror, history, 14 months ago, In English

The attempt: 196181712

The Loop:

long long cnt = 1e12;
long long A = 0;
while (cnt--) {
    A++;
}

I am trying to know how many operations of each type I can execute in 1 second on Codeforces, it was supposed to be trivial but lol, does anyone know how to calculate this on my own, or what am I doing wrong in my code?

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
14 months ago, # |
  Vote: I like it +25 Vote: I do not like it

Compiler optimizes it to A=1e12

  • »
    »
    14 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks, I was wondering why this wasn't happening locally

    • »
      »
      »
      14 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Compile with -O2 flag. You have to tell the compiler to turn on the optimizations.

      • »
        »
        »
        »
        14 months ago, # ^ |
          Vote: I like it +6 Vote: I do not like it

        Yeah i know now that CodeForces uses the optimization flags

»
14 months ago, # |
  Vote: I like it +41 Vote: I do not like it

This is because Codeforces secretly has quantum supercomputers which can do 1e18 operations per second. The thing is that it does 1e18 operations only when you intentionally try to get TLE.