제출 #49834

#제출 시각아이디문제언어결과실행 시간메모리
49834A_H_GhaznaviIzbori (COCI17_izbori)C++14
48 / 80
5 ms860 KiB
// In the name of god // A.H.Ghaznavi #include<bits/stdc++.h> using namespace std; typedef long long ll; int n,m,k,x[110][110],r; pair <int,int> p[110]; bool tf[110]; int main() { for (int i=0;i<110;i++) p[i].second=110-i; cin>>n>>m>>k; for (int i=1;i<=n;i++) { for (int i2=1;i2<=m;i2++) cin>>x[i][i2]; } for (int i=1;i<=n;i++) p[x[i][1]].first++; sort(p, p+m+1); tf[110-p[m].second]=true; cout<<110-p[m].second<<endl; while (!tf[k]) { tf[110-p[m].second]=true; r++; for (int i=1;i<=m;i++) { if (tf[i]) p[i].first=-1; else p[i].first=0; } for (int i=0;i<110;i++) p[i].second=110-i; for (int i=1;i<=n;i++) { for (int i2=1;i2<=m;i2++) { if (!tf[x[i][i2]]) { p[x[i][i2]].first++; break; } } } sort(p, p+m+1); tf[110-p[m].second]=true; } cout<<r; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...