lis05's blog

By lis05, history, 21 month(s) ago, In English

Hello Codeforces.

I made two identical submissions on the same problem.

C++ 17(64bit) — 842ms.

C++ 20(64bit) — 1138ms.

Does anyone know why the time differs so much?

  • Vote: I like it
  • +4
  • Vote: I do not like it

| Write comment?
»
21 month(s) ago, # |
  Vote: I like it +4 Vote: I do not like it

In my opinion C++20 is usually much quicker. Maybe it depends on the code.

»
21 month(s) ago, # |
Rev. 3   Vote: I like it +6 Vote: I do not like it

Removing two lines containing the following makes both c++ versions run in the same amount of time:

int cur=get(1,1,n,m);

C++17: 623ms/623ms
C++20: 623ms/624ms

Obviously, the problem was that compilers couldn't fully optimize away the unused call, but I don't know any details why such a difference.