Page 1 of 1

Input Question

Posted: Fri Nov 14, 2003 3:48 pm
by Wolfgang Haas
If a problem's input consists of lines with 2 integers and is not terminated by any special numbers, what should my termination condition look like?

I.e. Input:
1 2
5 3
6 2
4 1

I was using while (cin >> num1 >> num2), but when I submitted the problem I got "time limit exceeded".

I just wanted to find out if it's because how I handle the input, or if my program is just too slow...

Posted: Sat Nov 15, 2003 5:38 am
by UFP2161
That should work.

Posted: Sat Nov 15, 2003 8:59 am
by anupam
check out the algorithm you used. and also the arraysize.