이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |