# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
651402 | 2022-10-18T17:01:10 Z | BidoTeima | Izbori (COCI17_izbori) | C++17 | 1 ms | 212 KB |
/* ID: BidoTeima LANG: C++11 TASK: Izbori */ #include <bits/stdc++.h> using namespace std; using ll = long long; void moo(string filename); void ACPLS(string str = "") { if(str=="NOF")return; if(str.size()) moo(str); else{ #ifndef ONLINE_JUDGE freopen("output.txt", "w", stdout); freopen("input.txt", "r", stdin); #endif } ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } void moo(string fileName){ freopen((fileName+".in").c_str(),"r",stdin); freopen((fileName+".out").c_str(),"w",stdout); } #define tc \ int tttttt/*,subtask*/; \ cin >> tttttt/* >> subtask*/; \ while (tttttt--)/*end */ int main() { //ACPLS(""); int n,m,k; cin>>n>>m>>k; vector<vector<int>>a(n,vector<int>(m)); int f[m+1]={0}; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cin>>a[i][j]; if(j == 0) ++f[a[i][j]]; } reverse(a[i].begin(),a[i].end()); } int winner = 1; for(int i = 1; i <= m; i++){ if(f[i] > f[winner]) winner = i; } cout<<winner<<'\n'; bool vis[m+1]={0}; int ans = 0; while(winner != k){ vis[winner]=1; for(int i = 0; i < n; i++){ while(vis[a[i].back()]){ --f[a[i].back()]; a[i].pop_back(); ++f[a[i].back()]; } } for(int i = 1; i <= m; i++){ if(f[i] > f[winner]) winner = i; } ++ans; } cout<<ans<<'\n'; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Partially correct | 1 ms | 212 KB | Partially correct |
4 | Partially correct | 1 ms | 212 KB | Partially correct |
5 | Partially correct | 1 ms | 212 KB | Partially correct |
6 | Partially correct | 0 ms | 212 KB | Partially correct |
7 | Partially correct | 1 ms | 212 KB | Partially correct |
8 | Partially correct | 0 ms | 212 KB | Partially correct |
9 | Partially correct | 1 ms | 212 KB | Partially correct |
10 | Partially correct | 0 ms | 212 KB | Partially correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Partially correct | 1 ms | 212 KB | Partially correct |
14 | Partially correct | 1 ms | 212 KB | Partially correct |
15 | Partially correct | 1 ms | 212 KB | Partially correct |
16 | Partially correct | 1 ms | 212 KB | Partially correct |
17 | Partially correct | 1 ms | 212 KB | Partially correct |
18 | Partially correct | 1 ms | 212 KB | Partially correct |
19 | Partially correct | 1 ms | 212 KB | Partially correct |
20 | Partially correct | 1 ms | 212 KB | Partially correct |