On the last contest I have send identical code on compilers for all 3 versions and while I got time limit on ++17 and ++14, on ++20 it took slightly more than a second(twice as fast). Is C++20 that effective or how else that can be explained?
On the last contest I have send identical code on compilers for all 3 versions and while I got time limit on ++17 and ++14, on ++20 it took slightly more than a second(twice as fast). Is C++20 that effective or how else that can be explained?
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3603 |
| 4 | jiangly | 3583 |
| 5 | turmax | 3559 |
| 6 | tourist | 3541 |
| 7 | strapple | 3515 |
| 8 | ksun48 | 3461 |
| 9 | dXqwq | 3436 |
| 10 | Otomachi_Una | 3413 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 157 |
| 2 | adamant | 153 |
| 3 | Um_nik | 147 |
| 4 | Proof_by_QED | 146 |
| 5 | Dominater069 | 145 |
| 6 | errorgorn | 141 |
| 7 | cry | 139 |
| 8 | YuukiS | 135 |
| 9 | TheScrasse | 134 |
| 10 | chromate00 | 133 |
| Name |
|---|



What was the code?
https://mirror.codeforces.com/contest/1716/submission/167002044
Your code uses
long longs(64-bit integers) everywhere, so c++20 (which is 64-bit) will be faster than 32-bit versions. I suspect that if you run with c++17 64, it'll be about as fast as c++20.There should be a tangible performance difference between 64-bit and 32-bit compiled code, specially if your program uses 64-bit numeric data processing extensively and the compiled code is running on a 64-bit microprocessor.
Thank you. Am i right to understand that code on c++14 and c++17 is always 32 bits or i can change that somehow
With pleause.
RE: Your question
This depends on the compilation flags passed to the g++ compiler.
Check the following old blog about that issue.
About the programming languages
The Codeforces technical administration team should be able to confirm that the GNU c++14 and c++17 compilers generate 32-bit executable code by default, as I expect.
Note that the among the g++ compilation flags is the -m switch, which allows changing the default target architectural model used to generate the object code. Using -m32 should generate 32-bit executable code, and using -m64 should generate 64-bit executable code.
On the other hand, I checked your code, and found that it uses 64-bit integers extensively, as I expected. You may check the following update to your code, which was accepted using c++14.
167158251
Is there any guide you know which shows how to use them(I found how to set them in editor but how to "explain" that to Codeforces compiler)? In fact I have never heard about them before so that topic is probably not sufficient to me
What do you mean by "them"?
Are you referring to the g++ compilation flags?
Yes
The official reference that I often consult is the GCC Command Options of the GNU Compiler online documentation.
Using the GNU Compiler Collection (GCC)