Submission #539506

#TimeUsernameProblemLanguageResultExecution timeMemory
539506MurotYPoi (IOI09_poi)C++14
5 / 100
317 ms31764 KiB
#include <bits/stdc++.h> #define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ff first #define ss second #define ll long long using namespace std; const int N=2*1e3+7, M=1e9+7; ll a[N][N], b[N]; pair <ll, ll> ans[N]; void solve() { ll n, m, p; cin >> n >> m >> p; for (int i=1;i<=n;i++) ans[i].ff=ans[i].ss=0; for (int i=1;i<=m;i++) b[i]=0; for (int i=1;i<=n;i++){ for (int j=1;j<=m;j++) cin >> a[i][j]; } for (int j=1;j<=m;j++){ for (int i=1;i<=n;i++){ if (a[i][j] == 0) b[j]++; } } for (int i=1;i<=n;i++){ for (int j=1;j<=m;j++){ if (a[i][j] == 1) ans[i].ff+=b[j]; } ans[i].ss=i; } sort(ans+1,ans+n+1); for (int i=1;i<=n;i++){ // cout << ans[i].ff <<" " << ans[i].ss.ff <<" " << ans[i].ss.ss <<"\n"; if (ans[i].ss == p){ cout << ans[i].ff << " " << i; return ; } } } int main() { ios; int t=1; // cin >> t; while (t--){ solve(); cout << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...