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 h[15][2], hh[15][2];
int main()
{
int n;
scanf("%d", &n);
for(int i = 0; i < n; i++) { scanf("%d %d", &h[i][0], &h[i][1]); }//printf("%d %d\n", h[i][0], h[i][1]); }
for(int i = 0; i < n; i++) { scanf("%d %d", &hh[i][0], &hh[i][1]); }//printf("%d %d\n", hh[i][0], hh[i][1]); }
int s = 0;
for(int i = 0; i < n; i++) {
if(hh[i][1] > h[i][1]) {
if(hh[i][0] > h[i][1]) { s = -1; break; }
if(hh[i][0] == h[i][1]) { }
if(hh[i][0] < h[i][1]) { s++; }
}
else if(hh[i][1] == h[i][1]) { if(hh[i][0] != hh[i][1]) s++; }
else if(hh[i][1] > h[i][0] && hh[i][1] < h[i][1]) { s++; }
else if(hh[i][1] == h[i][0]) { }
else if(hh[i][1] < h[i][0]) { s = -1; break; }
}
printf("%d", s);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |