Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- #include <stdlib.h>
- #include <string>
- #include <string.h>
- #include <vector>
- #include <stack>
- #include <queue>
- #include <deque>
- #include <set>
- #include <map>
- #include <assert.h>
- #include <algorithm>
- #include <iomanip>
- #include <time.h>
- #include <math.h>
- #include <bitset>
- #include <fstream>
- #define int uint64_t
- using namespace std;
- int32_t main() {
- ios_base::sync_with_stdio(false);
- set<pair<int,int>> data;
- vector<pair<int,int>> data2;
- int n,xa,ya;
- cin >> n;
- for (int i = 0; i < n; i++) {
- cin >> xa >> ya;
- data.emplace(xa,ya);
- data2.emplace_back(xa,ya);
- }
- int counter = 0;
- for (int i = 0; i < n; i++) {
- auto x = data.upper_bound({data2[i].first, 0});
- auto y = data.upper_bound({data2[i].second, 0});
- bool flag = true;
- while (x != data.end()) {
- if (x->second > data2[i].second){
- flag = false;
- break;
- }
- x++;
- }
- while (y != data.end() && flag) {
- if (y->second > data2[i].first){
- flag = false;
- break;
- }
- y++;
- }
- counter += flag;
- }
- cout << counter;
- }
Advertisement
Add Comment
Please, Sign In to add comment