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<stdio.h>
#define max2(a,b) ((a)<(b)?(b):(a))
#define min2(a,b) ((a)>(b)?(b):(a))
int s1[12], e1[12], s2[12], e2[12], fl, cnt;
int main(){
int i, n;
scanf("%d", &n);
for(i=0; i<n; i++)scanf("%d%d", &s1[i], &e1[i]);
for(i=0; i<n; i++)scanf("%d%d", &s2[i], &e2[i]);
for(i=0; i<n; i++){
if(max2(s1[i],s2[i]) > min2(e1[i],e2[i]))fl=1;
if(max2(s1[i],s2[i]) < min2(e1[i],e2[i]))cnt++;
}
if(fl)puts("-1");
else printf("%d", cnt);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |