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>
#include<algorithm>
using namespace std;
typedef pair<int, int> pii;
int res;
int n;
pii a[99];
pii b[99];
int main()
{
scanf("%d",&n);
int i, j, k;
for(i=0;i<n;i++)
scanf("%d %d",&a[i].first,&a[i].second);
for(i=0;i<n;i++)
scanf("%d %d",&b[i].first,&b[i].second);
int nono = 0;
res = n;
for(i=0;i<n;i++)
{
if(a[i].first == b[i].second || a[i].second == b[i].first)
res--;
if(a[i].first > b[i].second || a[i].second < b[i].first)
nono = 1;
}
if(nono) printf("-1\n");
else printf("%d\n",res);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |