Submission #68764612
Source Code Expand
#include<bits/stdc++.h> #define ll long long using namespace std; int main(){ int n,m; cin >> n >> m; char a[n][m], v[m]; int p[n]{}; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cin >> a[i][j]; } } for(int i = 0; i < m; i++){ int oc = 0, zc = 0; for(int j = 0; j < n; j++){ if(a[j][i] == '0') zc++; else oc++; } if(oc == 0 or zc == 0) v[i] = '2'; else if(oc > zc) v[i] = '0'; else v[i] = '1'; } for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ if(a[j][i] == v[i]) p[j]++; else if(v[i] == '2') p[j]++; } } int mx = *max_element(p,p+n); for(int i = 0; i < n; i++){ if(p[i] == mx){ cout << i + 1 << " "; } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Most Minority |
User | JyuK_SIR |
Language | C++ 20 (gcc 12.2) |
Score | 200 |
Code Size | 797 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3708 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 3640 KiB |
sample_02.txt | AC | 1 ms | 3484 KiB |
sample_03.txt | AC | 1 ms | 3556 KiB |
test_01.txt | AC | 1 ms | 3496 KiB |
test_02.txt | AC | 1 ms | 3468 KiB |
test_03.txt | AC | 1 ms | 3616 KiB |
test_04.txt | AC | 1 ms | 3488 KiB |
test_05.txt | AC | 1 ms | 3544 KiB |
test_06.txt | AC | 1 ms | 3544 KiB |
test_07.txt | AC | 1 ms | 3616 KiB |
test_08.txt | AC | 1 ms | 3464 KiB |
test_09.txt | AC | 1 ms | 3504 KiB |
test_10.txt | AC | 1 ms | 3508 KiB |
test_11.txt | AC | 1 ms | 3504 KiB |
test_12.txt | AC | 1 ms | 3504 KiB |
test_13.txt | AC | 1 ms | 3468 KiB |
test_14.txt | AC | 1 ms | 3508 KiB |
test_15.txt | AC | 1 ms | 3544 KiB |
test_16.txt | AC | 1 ms | 3520 KiB |
test_17.txt | AC | 1 ms | 3560 KiB |
test_18.txt | AC | 1 ms | 3460 KiB |
test_19.txt | AC | 1 ms | 3708 KiB |
test_20.txt | AC | 1 ms | 3472 KiB |
test_21.txt | AC | 1 ms | 3500 KiB |
test_22.txt | AC | 1 ms | 3436 KiB |
test_23.txt | AC | 1 ms | 3544 KiB |
test_24.txt | AC | 1 ms | 3472 KiB |