Submission #377132

#TimeUsernameProblemLanguageResultExecution timeMemory
377132kevinxiehkPoi (IOI09_poi)C++17
100 / 100
772 ms12416 KiB
#include<bits/stdc++.h> using namespace std; struct con{ bool solve[2005]; int score=0; int cnt=0; int id=0; }ppl[2005]; bool cmp(con a,con b){ if(a.score==b.score){ if(a.cnt==b.cnt)return a.id<b.id; return a.cnt>b.cnt; } return a.score>b.score; } int cannot[2005]; int main(){ int n,t,p; cin>>n>>t>>p; for(int i=0;i<2000;i++)cannot[i]=0; for(int i=1;i<=n;i++){ ppl[i].id=i; for(int j=0;j<t;j++){ cin>>ppl[i].solve[j]; cannot[j]+=(1-ppl[i].solve[j]); if(ppl[i].solve[j])ppl[i].cnt++; } } for(int i=1;i<=n;i++){ for(int j=0;j<t;j++){ ppl[i].score+=ppl[i].solve[j]*cannot[j]; } } sort(ppl+1,ppl+n+1,cmp); int rank=1; while(ppl[rank].id!=p)rank++; cout<<ppl[rank].score<<" "<<rank<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...