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<cstdio>
#include<cassert>
#include<cstring>
#include<map>
#include<set>
#include<time.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> s(n), e(n);
for(int i = 0; i < n; ++i)
cin >> s[i] >> e[i];
int neg = 0, pos = 0;
for(int i = 0; i < n; ++i) {
int si, ei;
cin >> si >> ei;
s[i] = max(si, s[i]);
e[i] = min(ei, e[i]);
if(e[i] - s[i] < 0) ++neg;
if(e[i] - s[i] > 0) ++pos;
}
if(neg)
cout << -1 << endl;
else
cout << pos << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |