Submission #9152

#TimeUsernameProblemLanguageResultExecution timeMemory
9152pichuliaN-orthotope (kriii2_N)C++98
4 / 4
0 ms1088 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...