Submission #9149

#TimeUsernameProblemLanguageResultExecution timeMemory
9149ainu7N-orthotope (kriii2_N)C++98
4 / 4
0 ms1676 KiB
#include <math.h> #include <stdio.h> #include <string.h> #include <vector> #include <string> #include <queue> #include <map> #include <algorithm> #include <cmath> #include <iostream> #include <sstream> #include <set> using namespace std; int main() { int N; cin >> N; vector<int> s1(N), e1(N), s2(N), e2(N); for (int i=0; i<N; i++) cin >> s1[i] >> e1[i]; for (int i=0; i<N; i++) cin >> s2[i] >> e2[i]; int cnt = 0; int impos = 0; for (int i=0; i<N; i++) { int s = max(s1[i], s2[i]); int e = min(e1[i], e2[i]); if (s < e) cnt ++; if (s > e) impos = 1; } if (impos) cout << -1 << endl; else cout << cnt << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...