Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- bool cmpare(const pair<int,int> &p1, const pair<int,int> &p2 )
- {
- if(p1.first>p2.first) return 1;
- else if(p1.first==p2.first) return (p1.second<p2.second);
- else return (p1.first>p2.first);
- }
- int main()
- {
- int n,k;
- cin>>n>>k;
- vector<pair<int,int>>v(n);
- for(int i=0;i<n;i++)
- {
- cin>>v[i].first>>v[i].second;
- }
- sort(v.begin(),v.end() ,cmpare);
- int coun=0;
- for(auto u:v)
- {
- if(u==v[k-1]) coun++;
- }
- cout<<coun;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement