Submission #9155

#TimeUsernameProblemLanguageResultExecution timeMemory
9155coreaN-orthotope (kriii2_N)C++14
4 / 4
0 ms1676 KiB
#include <cstdio> #include <vector> #include <iostream> using namespace std; int main() { int n; while(cin >> n) { vector<int> a, b, c, d; a.resize(n); b.resize(n); c.resize(n); d.resize(n); for(int i=0; i<n; ++i) cin >> a[i] >> b[i]; for(int i=0; i<n; ++i) cin >> c[i] >> d[i]; vector<int> e, f; e.resize(n); f.resize(n); for(int i=0; i<n; ++i) { e[i] = max(a[i], c[i]); f[i] = min(b[i], d[i]); } int ans = 0; for(int i = 0; i < n; ++ i) { if(e[i] > f[i]) { ans = -1; break; } else if(e[i] < f[i]) { ans ++; } } cout << ans << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...