BurnedChicken's blog

By BurnedChicken, history, 14 months ago, In English

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.

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

»
14 months ago, hide # |
Rev. 3  
Vote: I like it -47 Vote: I do not like it

I'm sorry to remove my comment

»
14 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 months ago, hide # |
 
Vote: I like it -13 Vote: I do not like it

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 months ago, hide # |
 
Vote: I like it +22 Vote: I do not like it

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