Блог пользователя jaglike_makkar

Автор jaglike_makkar, история, 3 года назад, По-английски

I submitted my code for 1612E - Messages in different C++ compilers and here are the results:

  1. C++14 — 138535056 — Accepted (1481 ms)
  2. C++17 (64) — 138534883 — TLE (3000 ms)
  3. C++17 — 138534840 — Accepted (1559 ms)
  4. C++20 (64) 138534744 — TLE (3000 ms)

All 4 are the same codes. I can understand that there can be minor differences in time taken, but here the difference is around 1.5 ms. I mostly code in python and don't have much idea on performance differences between different C++ compilers.

As far as I can think, int operations are faster in C++ while long long operations are faster in C++ (64). But still, the difference is huge. Is there any other reason and how to decide appropriate C++ compiler?

  • Проголосовать: нравится
  • +17
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Changed your for loop on line 20 to iterate over your map using references so you don't create copies of all the items, runs in 904 ms on C++ 20 (64). 138860478