Submission #9367

#TimeUsernameProblemLanguageResultExecution timeMemory
9367silasN-orthotope (kriii2_N)C++98
4 / 4
0 ms1676 KiB
#include <iostream> #include <vector> #include <utility> using namespace std; int main() { int n; cin >> n; vector<pair<int, int> > v1, v2; for (int i = 0; i < n; i++){ int s, e; cin >> s >> e; v1.push_back(make_pair(s, e)); } for (int i = 0; i < n; i++){ int s, e; cin >> s >> e; v2.push_back(make_pair(s, e)); } int ans = 0; for (int i = 0; i < n; i++){ int si = v1[i].first, ei = v1[i].second, sj = v2[i].first, ej = v2[i].second; if (ei < sj || si > ej) { cout << -1 << endl; goto l; } else if (ei == sj || si == ej) { ans += 0; } else { ans++; } } cout << ans << endl; l:; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...