Hidden_Walker_1.0's blog

By Hidden_Walker_1.0, history, 4 years ago, In English

In 1 second or 2 second or 3 second highest how much loop executed ?? How to i find it by own experiment..In generally our IDE(i used codeblocks ) don't give proper executed time..

»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

It's around 10^8 iterations in 1 second.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    No. It really depends what is inside the loop. If the loop has simple array access, + or — or multiplication, with integer numbers, then it will take like around 0.6 second or even less on CF. If the loop contains long long operations with division or modular arithmetic, it might take way more.

  • »
    »
    4 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    No. Sometimes 1000^3 passes in 1 second, I used N=1000 Floyd N^3 algorithm and got 960ms in a Korean ps site.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      But, if your program is constant-heavy(ex.set), you sometimes don't make 5*10^7.

»
4 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

The following is an example that demonstrates measuring the average elapsed time per iteration when computing the sum of an arithmetic series. Example. The example is based on the timer class that was presented in previous blog A simple five lines of code C++ timer class to measure elapsed time. The same example gave 0.2782 nsec average execution time per iteration when compiled using GNU G++17 9.2.0 64-bit compiler and run on Codeforces using Custom Invocation.