-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path116A.cpp
More file actions
47 lines (46 loc) · 1.07 KB
/
116A.cpp
File metadata and controls
47 lines (46 loc) · 1.07 KB
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
39
40
41
42
43
44
45
46
47
#include<bits/stdc++.h>
using namespace std;
bool compare(pair<int,int>p1,pair<int,int> p2)
{
if(p1.first>p2.first)
return true;
if(p1.first==p2.first && p1.second<p2.second)
return true;
return false;
}
int main(){
int n,m;
cin>>n>>m;
if(n==1){
cout<<1;
return 0;
}
pair<int,int>a[n+1];
for(int i=1;i<=n;i++){
cin>>a[i].first>>a[i].second;
}
sort(a+1,a+n+1,compare);
int k=0;
for(int i=2;i<n+1;i++){
int f=1;
int flag=0;
while(a[i-1].first==a[i].first && a[i-1].second==a[i].second ){
// cout<<a[i-1].first<<" "<<a[i].first<<" "<<a[i-1].second<<" "<<a[i].second<<"\n";
i++;
f++;
if(i==n+1){
flag=1;
break;
}
}
//cout<<f<<" "<<i<<"\n";
if(i>m){
cout<<f<<"\n";
return 0;
}
if(i==n && i==m && flag)
{cout<<f<<"\n";
return 0;}
}
cout<<1<<"\n";
}