Submission #9353

#TimeUsernameProblemLanguageResultExecution timeMemory
9353shashackN-orthotope (kriii2_N)C++98
4 / 4
0 ms1676 KiB
#include<iostream> #include<vector> using namespace std; int main(){ int N; cin >> N; vector<pair<int, int> > one(N); vector<pair<int, int> > two(N); for (int i = 0; i < N; i++){ int l, r; cin >> l >> r; one[i] = make_pair(l, r); } for (int i = 0; i < N; i++){ int l, r; cin >> l >> r; two[i] = make_pair(l, r); } int ans = 0; bool check = false; for (int i = 0; i < N; i++){ if (one[i].second < two[i].first || one[i].first > two[i].second) check = true; else if (one[i].second == two[i].first || one[i].first == two[i].second) continue; else ans++; } if (check) cout << -1 << endl; else cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...