ivolff

Untitled

Apr 11th, 2020
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <stdlib.h>
  4. #include <string>
  5. #include <string.h>
  6. #include <vector>
  7. #include <stack>
  8. #include <queue>
  9. #include <deque>
  10. #include <set>
  11. #include <map>
  12. #include <assert.h>
  13. #include <algorithm>
  14. #include <iomanip>
  15. #include <time.h>
  16. #include <math.h>
  17. #include <bitset>
  18. #include <fstream>
  19.  
  20. #define int uint64_t
  21.  
  22. using namespace std;
  23.  
  24. int32_t main() {
  25.     ios_base::sync_with_stdio(false);
  26.     set<pair<int,int>> data;
  27.     vector<pair<int,int>> data2;
  28.     int n,xa,ya;
  29.     cin >> n;
  30.     for (int i = 0; i < n; i++) {
  31.         cin >> xa >> ya;
  32.         data.emplace(min(xa,ya), max(xa,ya));
  33.         data2.emplace_back(min(xa,ya), max(xa,ya));
  34.     }
  35.     int counter = 0;
  36.     for (auto obj : data2) {
  37.         bool is_found = false;
  38.         for (auto el : data) {
  39.             if (el.first > obj.first && el.second > obj.second) {
  40.                 is_found = true;
  41.                 break;
  42.             }
  43.         }
  44.         if (!is_found)
  45.             counter++;
  46.     }
  47.     cout << counter;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment