Robot judges suck! I've been accepted by UVA, only after removing the following chunks of code:
cin >> ntc;
/* extract newline from previous read */
char dummy(0);
cin.get(dummy);
assert( '\n'==dummy );
/* newline extract completes */
Replacing it with :
cin >> ntc;
getline( cin, inputN ); /* extract remaining '\n' */
Before replacement the honorable robot judge at UVA would verdict:
Your submission .... has failed with verdict Time limit exceeded.
Your program used more CPU time than what is allowed for this problem. That means that your algorithm is not fast enough or that it entered into an infinite loop.
After the replacement the program took 0.052 seconds to run!
- In what way could it be related with the replaced code?
- Is there any document on how does UVA robot judge differ from other compilers? So that I know what functions/methods are available on the online judge.
I use MinGW.