1 / 9
May 2009

i want to know how the spoj stop when it finds a WA
my doubt is .....
it first input all data sets and later check the answers or
it do that simultaneusly......
thanks

Hi,
it depends on whether problem has multiple input data or not.

Input file always appears on input stream - it is up to you, whether you cache whole answer and then write it to the output stream, or whether you write some piece of answer every time you receive piece of input data.

For single input data judging looks like this:
INPUT-FILE >> YOUR-PROGRAM >> JUDGE
In this case if wrong answer is found, your program will be terminated.

For multiple data:
LOOP {
INPUT-FILE >> YOUR-PROGRAM >> TEST-CASE-JUDGE
}

MASTER-JUDGE
In this case, if test-case-judge gets wrong answer, program will be terminated and will start again for the next test case. In the end, master-judge decides if solution can be accepted or not.

2 months later

what is the name of the input file for submitting problems which include file input?
for example problem 371 aka boxes.

All input is read from the standard input stream, not from a file. (When the problem says 'the input file', that is because the input is being redirected from a file to stdin, but you just read from stdin.)

example (boxes):
let us have 2 cases:
0 0 0 5 0
0 0 2 4 3 1 0 0 0 0 0 1 - example case.
would stream look like:
2 5 0 0 0 5 0 12 0 0 2 4 3 1 0 0 0 0 0 1 ?

There will be line breaks between some of the numbers as specified in the input section - it would be

2
0 0 0 5 0
0 0 2 4 3 1 0 0 0 0 0 1
6 months later

In Prime1 problem is it supposed to read the input
Example:

2
1 10
2 10

and then start working .. and generating output

2
3
5
7
2
3
5
7

Or should I read the number of execution time(s) then process line by line and out put ..
Example

2
1 10

output

2
3
5
7

then read next input instance

2 10

and output

2
3
5
7

The judge has no possible way of knowing when you are printing out answers. All that matters is your output has to match the correct output.