Submission #9156

#TimeUsernameProblemLanguageResultExecution timeMemory
9156kcm1700N-orthotope (kriii2_N)C++14
4 / 4
0 ms1088 KiB
#include <cstdio> #include <algorithm> using namespace std; int n; int s1[20],s2[20]; int e1[20],e2[20]; int main(){ scanf("%d",&n); for(int i = 0; i < n; i++) scanf("%d%d",&s1[i],&e1[i]); for(int i = 0; i < n; i++) scanf("%d%d",&s2[i],&e2[i]); int cnt = 0; for(int i = 0; i < n; i++) { if (s1[i] > e2[i] || s2[i] > e1[i]) { puts("-1"); return 0; } if (s1[i] == e2[i] || s2[i] == e1[i]) { continue; } cnt++; } printf("%d\n",cnt); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...