제출 #539501

#제출 시각아이디문제언어결과실행 시간메모리
539501MurotYPoi (IOI09_poi)C++14
0 / 100
302 ms31796 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, pair <ll,ll>> ans[N]; void solve() { ll n, m, p; cin >> n >> m >> p; for (int i=1;i<=n;i++) b[i]=0, ans[i].ff=ans[i].ss.ff=ans[i].ss.ss=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]; if (a[i][j] == 1) ans[i].ss.ff+=1; ans[i].ss.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.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...