Submission #678662

#TimeUsernameProblemLanguageResultExecution timeMemory
678662penguin133Poi (IOI09_poi)C++17
100 / 100
564 ms23732 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n,m,k; cin >> n >> m >> k; int grid[n][m]; int cnt[m]; memset(cnt,0,sizeof(cnt)); for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin >> grid[i][j]; if(grid[i][j] == 1){ cnt[j]++; } } } int cnt2 = 0,cnt3 = 0,cnt5 = 0; for(int i=0;i<m;i++){ cnt[i] = n - cnt[i]; if(grid[k-1][i] == 1){ cnt2 += cnt[i]; cnt5++; } } cout << cnt2 << " "; int cnt4 = 0,cnt6 = 0; for(int i=0;i<n;i++){ cnt3 = 0; cnt6 = 0; if(i == k-1)continue; for(int j=0;j<m;j++){ if(grid[i][j] == 1){ cnt3 += cnt[j]; cnt6++; } } if(cnt3 > cnt2){ cnt4++; } else if(cnt3 == cnt2){ if(cnt6 > cnt5){ cnt4++; } else if(cnt6 == cnt5){ if(i < k-1){ cnt4++; } } } } cout << cnt4+1; }
#Verdict Execution timeMemoryGrader output
Fetching results...