This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
int data[2][100][2];
int n;
int main(void)
{
scanf("%d", &n);
for(int i = 0; i < n; i++) scanf("%d %d", data[0][i], data[0][i] + 1);
for(int i = 0; i < n; i++) scanf("%d %d", data[1][i], data[1][i] + 1);
int ans = n;
for(int i = 0; i < n; i++)
{
int left = 0;
if(data[0][i][0] > data[1][i][0]) left = 1;
if(data[left][i][1] == data[!left][i][0]) ans--;
else if(data[left][i][1] < data[!left][i][0])
{
ans = -1;
break;
}
}
printf("%d\n", ans);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |