Advertisement
sajid161

5:3

Jan 1st, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. bool cmpare(const pair<int,int> &p1, const pair<int,int> &p2 )
  4. {
  5.     if(p1.first>p2.first) return 1;
  6.     else if(p1.first==p2.first) return (p1.second<p2.second);
  7.     else return (p1.first>p2.first);
  8. }
  9. int main()
  10. {
  11.     int n,k;
  12.     cin>>n>>k;
  13.     vector<pair<int,int>>v(n);
  14.     for(int i=0;i<n;i++)
  15.     {
  16.         cin>>v[i].first>>v[i].second;
  17.     }
  18.     sort(v.begin(),v.end() ,cmpare);
  19.     int coun=0;
  20.     for(auto u:v)
  21.     {
  22.         if(u==v[k-1]) coun++;
  23.     }
  24.     cout<<coun;
  25.  
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement