Submission #14027

#TimeUsernameProblemLanguageResultExecution timeMemory
14027gs14004N-orthotope (kriii2_N)C++14
4 / 4
0 ms1084 KiB
#include <cstdio> #include <algorithm> using namespace std; int main(){ int n, s1[11], e1[11], s2[11], e2[11]; 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]); s1[i] = max(s1[i],s2[i]); e1[i] = min(e1[i],e2[i]); } int cnt = 0; for (int i=0; i<n; i++) { if(s1[i] > e1[i]){ puts("-1"); return 0; } if(s1[i] < e1[i]) cnt++; } printf("%d",cnt); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...