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