This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |