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

Автор BurnedChicken, история, 14 месяцев назад, По-английски

I was solving 1610H - Squid Game, and after submitting, I thought that the TLE verdict that I got is mysterious and I didn't know why. But after I changed language to C++17, it comfortably passed in under 500ms. And I changed it again to C++20, the result is similar, hinting that my code might be correct.

The three submissions should be identical except languages. 328699971 328700051 328700454

I'm not a compiler expert and I'm too lazy to construct a smaller breaking code, so I'm just posting an example here.

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

»
14 месяцев назад, скрыть # |
Rev. 3  
Проголосовать: нравится -47 Проголосовать: не нравится

I'm sorry to remove my comment

»
14 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Weird, I tried it myself in gym two times, your submission TLEd at tc 59 instead and tc 43 passed in just 250ms, it was passing all testcases fine just randomly blew up at tc 59.

»
14 месяцев назад, скрыть # |
 
Проголосовать: нравится -13 Проголосовать: не нравится

Meanwhile, my solution in a d3E passed in 1999ms after dozens of failed hacking attempts in c++ 23 but tle'd in C++ 17

»
14 месяцев назад, скрыть # |
 
Проголосовать: нравится +22 Проголосовать: не нравится

Interesting, I wonder if this is related to https://codeforces.me/blog/entry/126654 or not? Unsure if that got resolved or not.

After a while, I managed to get your C++23 submission to AC just by splitting

for(int i=1; i<n; ++i) cin >> par[i],par[i]--,adj[par[i]].pb(i);

into

for(int i=1; i<n; ++i) cin >> par[i];
for(int i=1; i<n; ++i) par[i]--,adj[par[i]].pb(i);

Before: 328699971

After: 330538688