-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathb.cc
More file actions
31 lines (29 loc) · 609 Bytes
/
Copy pathb.cc
File metadata and controls
31 lines (29 loc) · 609 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
// https://codingcompetitions.withgoogle.com/codejam/round/0000000000201900/0000000000201845
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
int main(){
int T,n,c,m,p,b;
cin>>T;
for(int t=1;t<=T;t++){
cin>>n>>c>>m;
vi a(n),d(c);
for(int i=0;i<m;i++){
cin>>p>>b;
p--;b--;
a[p]++;
d[b]++;
}
int M=0;
for(int i=0;i<c;i++)M=max(M,d[i]);
int s=0;
for(int i=0;i<n;i++){
s+=a[i];
M=max((s-1)/(i+1)+1,M);
}
int k=0;
for(int i=0;i<n;i++)
if(a[i]>M)k+=a[i]-M;
printf("Case #%d: %d %d\n",t,M,k);
}
}