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!