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 <stdio.h>
#include <set>
#include <vector>
using namespace std;
int main(void){
int N;
scanf("%d", &N);
int tmpa, tmpb;
vector<pair<int, int> > pair_vec;
for(int i=0; i<N; i++){
scanf("%d%d", &tmpa, &tmpb);
pair_vec.push_back(make_pair(tmpa, tmpb));
}
int on_line_count=0;
for(int i=0; i<N; i++){
scanf("%d%d", &tmpa, &tmpb);
if(tmpa > pair_vec[i].first){
if(tmpb < pair_vec[i].first){
printf("-1\n");
return 0;
}
else if(tmpb == pair_vec[i].first){
on_line_count += 1;
}
else{
continue;
}
}
else{
if(tmpa > pair_vec[i].second){
printf("-1\n");
return 0;
}
else if(tmpa == pair_vec[i].second){
on_line_count += 1;
}
else{
continue;
}
}
}
printf("%d\n", N-on_line_count);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |