Hello. I am getting “wrong answer” as output when submitting solution of the problem RaceWars but, when I tested the same code in the CodeChef online IDE, it gave the expected result, e.g. when i gave the time taken by Dom’s players as- 1, 2, 1, and that of the rival’s players as- 2, 1, 5, as input, the answer it gave was 2 and I believe it was correct. Don’t know why it shows wrong answer when I submit it. I desperately need someone’s help in sorting this out. Thanks in advance.
Here’s the solution code:
#include<stdio.h>
int main()
{
char match=‘N’;
int r[100], d[100], checked[100];
int i, j, t, n, k, csize=0, points=0;
// input
scanf("%d", &t);
scanf("%d", &n);
// processing
while( t-- )
{
for(i = 0; i < n; i++)
{
scanf("%d", &d[i]);
}
for(i = 0; i < n; i++)
{
scanf("%d", &r[i]);
}
for(i = 0; i < n; i++)
{
for(j = 0; j < n; j++)
{
for(k=0; k < csize; k++)
{
if(checked[k] == j)
{
match = 'Y';
break;
}
}
if(match == 'Y')
{
match = 'N';
continue;
}
if(d[i] < r[j])
{
points++;
checked[csize++] = j;
break;
}
}
}
printf("%d", points);
}
return 0;
}