Submission #720334

#TimeUsernameProblemLanguageResultExecution timeMemory
720334Yell0Poi (IOI09_poi)C++17
100 / 100
266 ms12048 KiB
#include <bits/stdc++.h> using namespace std; int N,T,P,sc[2002],tot[2002],sol[2002],ans[2002]; bool a[2002][2002]; int main() { ios::sync_with_stdio(0);cin.tie(0); cin>>N>>T>>P; for(int i=1;i<=N;++i) for(int j=1;j<=T;++j) cin>>a[i][j]; for(int i=1;i<=T;++i) for(int j=1;j<=N;++j) sc[i]+=!a[j][i]; for(int i=1;i<=N;++i) for(int j=1;j<=T;++j) { tot[i]+=sc[j]*a[i][j]; sol[i]+=a[i][j]; } iota(ans+1,ans+1+N,1); sort(ans+1,ans+1+N,[](int x,int y) {return (tot[x]==tot[y]?(sol[x]==sol[y]?x<y:sol[x]>sol[y]):tot[x]>tot[y]);}); cout<<tot[P]<<' '; for(int i=1;i<=N;++i) if(ans[i]==P) cout<<i<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...