Advertisement
momo2345

Rank list

Jul 26th, 2020
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define op ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0)
  4. #define endl "\n"
  5.  
  6. /*bool momo(const pair<int,int>&p1,const pair<int,int>&p2){
  7.     if(p1.first>p2.first) return 1;
  8.     else if (p1.first==p2.first) return p1.second < p2.second;
  9.     return 0;
  10. }*/
  11. int main()
  12. {
  13.     op;
  14.     int n,k;
  15.     cin>>n>>k;
  16.     int a=0;
  17.     vector<pair<int,int> >v;
  18.     for(int i=0;i<n;i++) {
  19.         int l,m;
  20.         cin>>l>>m;
  21.         l=l*(-1);
  22.         v.push_back(make_pair(l,m));
  23.     }
  24.    // sort(v.begin(),v.end(),momo);
  25.     sort(v.begin(),v.end());
  26.     for(auto u: v){
  27.         if(u==v[k-1]) a++;
  28.     }
  29.     cout<<a<<endl;
  30.  
  31.   /*  pair<int,int>p[52];
  32.     for(int i=0;i<n;i++){
  33.         cin>>p[i].first>>p[i].second;
  34.         p[i].first*=(-1);
  35.     }
  36.     sort(p,p+n);
  37.     cout<<(count(p,p+n,p[k-1]))<<endl;*/
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement