Advertisement
askarulytarlan

d

Feb 8th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. using namespace std;
  5.  
  6. struct Pair {
  7. int m, h;
  8. } a[100500];
  9.  
  10.  
  11. bool cmp(Pair p1, Pair p2) {
  12. return p1.m < p2.m && p1.h < p2.h;
  13. }
  14.  
  15. int main(){
  16. int n, w, h;
  17. int q[100500][2];
  18. cin >> n >> w >> h;
  19. for(int i = 1; i <= n; i++){
  20. cin >> a[i].m >> a[i].h;
  21. }
  22. for(int i = 1; i <= n; i++){
  23. q[i][0] = a[i].m;
  24. q[i][1] = a[i].h;
  25. }
  26. int ans = 1;
  27. sort(a+1, a+n+1, cmp);
  28. int w[100500][2];
  29. for(int i = 2; i <= n; i++){
  30. if(a[i].m > a[i-1].m && a[i].h > a[i-1].h){
  31. ans++;
  32. }
  33. }
  34. for(int i = 1; <= n; i++)
  35. cout << ans;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement