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
created
last reply
- 8
replies
- 676
views
- 5
users
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.
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