Weirdest TLE — CSES (Grid Paths)

Revision en1, by Blaz, 2021-10-25 00:36:36

Hello,

With some friends we are very confused because of this. We have these two different codes:

The weird thing is that they are the same code, but the ONLY difference is how we read the input to the global string "path".

On the AC code:

string sAux; // line 69
cin >> sAux;
 
path = sAux;

On the TLE code:

cin >> path; // line 69

The submission that gives TLE reads directly into the global variable, while the AC code reads into an intermediary local string and then assigns to the global variable.

We have absolutely no idea why or how this makes any difference.

Any ideas? Thanks!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Blaz 2021-10-25 00:36:36 817 Initial revision (published)