Well, in here its 00:40 midnight

I coded the problem and got AC on first try. The inputs are not so huge so here's a simple algorithm. Hope it helps.
get n and get n lines onto CORRECT answer
get m and get m lines onto INPUT strings
if(n == m) it means sizes are equal so there is a probability for AC. so
inside a loop check if every string of INPUT is exactly equal to corresponding CORRECT answer set. if so, return AC.
else
get two another strings. For each of these sets (CORRECT and INPUT) just push the numbers onto these strings then compare them. if they are equal, return PE.
else
return WA.
I used std::string for my c++ program and used the += and == operators.
Just like that.
As for the previous post, the first thing I noticed is that your program does not initialize the arrays so just move the last lines after the while loop. Like this:
Code: Select all
while(1){
answer[0] = submit[0] = answer_num[0] = submit_num[0] = '\0';
//....
But after this, you'll get RE too. But why? Because each line is 120 chars at max, Not 50. So just change the first line of your code to:
Code: Select all
char answer[81*122], submit[81*122], line[122], answer_num[81*122], submit_num[81*122];
AAAH, you forgot something else. Each input can be 100 lines, not 81 lines. So that should be:
Code: Select all
char answer[101*122], submit[101*122], line[122], answer_num[101*122], submit_num[101*122];
Note that just for safety I used 101 and 122instead of 100 and 100. But after this, you'll get WA.
Also I suggest you to use dynamic arrays for these types of arrays (with huge sizes). Like this:
Code: Select all
char line[122];
char *answer = (char*)malloc(101*122);
char *submit = (char*)malloc(101*122);
char *answer_num = (char*)malloc(101*122);
char *submit_num = (char*)malloc(101*122);
//...
free(answer);
free(submit);
free(answer_num);
free(submit_num);
So what about the WA? After trying this input you'll get the idea:
Code: Select all
3
123
123
123
1
123123123
0
//output
Run #1: Presentation Error
But your program accepts it. Because you don't include the new line characters. So just use something like this:
Code: Select all
for(i=0; i<answer_lines; i++){
gets(line);
strcat(answer, " "); //add space instead of new line
strcat(answer, line);
}
You should use this for input of submit array too.
Hope it helps.
I didn't test the program but I think it should get AC.