Submission #9192

#TimeUsernameProblemLanguageResultExecution timeMemory
9192dominyellowN-orthotope (kriii2_N)C++98
4 / 4
0 ms1204 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...