-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path113A.cpp
More file actions
38 lines (34 loc) · 792 Bytes
/
Copy path113A.cpp
File metadata and controls
38 lines (34 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include<bits/stdc++.h>
#include <utility>
using namespace std;
#define ll long long in
bool sortinrev(const pair<int,int> &a, const pair<int,int> &b)
{
if(a.first>b.first){
return true;
}
else if(a.first ==b.first){
return a.second < b.second;
}
else{ return false; }
}
int main(){
vector< pair <int, int> > vect;
int n,k,cnt=0,i=0;
cin>>n>>k;
int a,b;
for(int i=0;i<n;i++){
cin>>a>>b;
vect.push_back( make_pair(a,b));
}
sort(vect.begin(), vect.end(), sortinrev);
while(vect[i].first>=vect[k-1].first){
if(vect[i].first==vect[k-1].first && vect[i].second==vect[k-1].second){
cnt++;
}
i++;
}
cout<<cnt<<endl;
return 0;
}