When I was doing the problem [C. Pokémon Arena](https://mirror.codeforces.com/contest/1936/problem/C) in the last Div. 1 round, I submitted my solution and got a TLE on pretest 20.↵
↵
* GNU C++20 (64), TLE 3000ms [submission:248951083].↵
↵
I was not suspecting anything but my code, I thought there may be some degenerate issue, undefined behavior or constant issue, but nothing really found. After some unsuccessful attempts, I was able to pass the pretest using fast IO. It's then I found something weird: it only takes a few hundred milliseconds, which is contradictory to my intuition: `cin` with `sync_with_stdio(false)` is fairly fast and it should not take up so much more (at least 10x) time.↵
↵
After the contest, I submitted exactly the same code with different language. You know what?↵
↵
* GNU C++17, AC 280ms [submission:248983571]↵
↵
It's not only me, and some other participants also encountered such issue. For example:↵
↵
* GNU C++20 (64), TLE [submission:248946386] by [user:fallleaves01,2024-03-01].↵
↵
But there are also some successful cin submission using GNU C++20 (64). ↵
↵
Here's snippet for the key code:↵
↵
```cpp↵
int n, m;↵
cin >> n >> m;↵
vector a(n, vector (m, 0));↵
vector c(n, 0);↵
for (int i = 0; i < n; i++) cin >> c[i];↵
for (int i = 0; i < n; i++) {↵
for (int j = 0; j < m; j++) {↵
cin >> a[i][j];↵
}↵
}↵
```↵
↵
After some investigation by (including but not limit to) [user:Sugar_fan,2024-03-01], [user:Boboge,2024-03-01], [user:-skyline-,2024-03-01], the key components of TLE is:↵
↵
* The language must be GNU C++20 (64).↵
* `vector` must be of `int`. If the elements are `long long`, it passed. [submission:249004456]↵
* The definition of 2D `vector` must be before reading `c`. If swap these two lines, it passed. [submission:249004217]↵
↵
So here's the thing. It could not even be simply interpreted as some branch mispredictions or cache misses, it seems something is completely broken,butand we still don't understand what is actually wrong.
↵
* GNU C++20 (64), TLE 3000ms [submission:248951083].↵
↵
I was not suspecting anything but my code, I thought there may be some degenerate issue, undefined behavior or constant issue, but nothing really found. After some unsuccessful attempts, I was able to pass the pretest using fast IO. It's then I found something weird: it only takes a few hundred milliseconds, which is contradictory to my intuition: `cin` with `sync_with_stdio(false)` is fairly fast and it should not take up so much more (at least 10x) time.↵
↵
After the contest, I submitted exactly the same code with different language. You know what?↵
↵
* GNU C++17, AC 280ms [submission:248983571]↵
↵
It's not only me, and some other participants also encountered such issue. For example:↵
↵
* GNU C++20 (64), TLE [submission:248946386] by [user:fallleaves01,2024-03-01].↵
↵
But there are also some successful cin submission using GNU C++20 (64). ↵
↵
Here's snippet for the key code:↵
↵
```cpp↵
int n, m;↵
cin >> n >> m;↵
vector a(n, vector (m, 0));↵
vector c(n, 0);↵
for (int i = 0; i < n; i++) cin >> c[i];↵
for (int i = 0; i < n; i++) {↵
for (int j = 0; j < m; j++) {↵
cin >> a[i][j];↵
}↵
}↵
```↵
↵
After some investigation by (including but not limit to) [user:Sugar_fan,2024-03-01], [user:Boboge,2024-03-01], [user:-skyline-,2024-03-01], the key components of TLE is:↵
↵
* The language must be GNU C++20 (64).↵
* `vector` must be of `int`. If the elements are `long long`, it passed. [submission:249004456]↵
* The definition of 2D `vector` must be before reading `c`. If swap these two lines, it passed. [submission:249004217]↵
↵
So here's the thing. It could not even be simply interpreted as some branch mispredictions or cache misses, it seems something is completely broken,