Submission #730142

#TimeUsernameProblemLanguageResultExecution timeMemory
730142lucriPoi (IOI09_poi)C++17
100 / 100
575 ms11984 KiB
#include <bits/stdc++.h> using namespace std; bool a[2010][2010]; int n,t,p,sc[2010]; struct results{int code,solved,score;}v[2010]; bool comp(results a,results b) { if(a.score!=b.score) return a.score>b.score; if(a.solved!=b.solved) return a.solved>b.solved; return a.code<b.code; } int main() { cin>>n>>t>>p; for(int i=1;i<=t;++i) sc[i]=n; for(int i=1;i<=n;++i) { v[i].code=i; for(int j=1;j<=t;++j) { cin>>a[i][j]; v[i].solved+=a[i][j]; sc[j]-=a[i][j]; } } for(int i=1;i<=n;++i) { for(int j=1;j<=t;++j) { if(a[i][j]) v[i].score+=sc[j]; } } cout<<v[p].score<<' '; sort(v+1,v+n+1,comp); for(int i=1;i<=n;++i) if(v[i].code==p) cout<<i; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...