Submission #609864

#TimeUsernameProblemLanguageResultExecution timeMemory
609864ozedPoi (IOI09_poi)C++14
100 / 100
617 ms23876 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int,int> pi; struct competition{ int score; int solved; int id; }; bool compare(competition &t1,competition &t2){ if(t1.score > t2.score){return true;} else if(t1.score<t2.score){return false;} else if(t1.solved >t2.solved){return true;} else if(t1.solved <t2.solved){return false;} else return t1.id <t2.id; } int main(){ int n,t,p; cin>>n>>t>>p; vector<competition>v(n); vector<vi>v1(n); vi score(t); for(int i=0;i<n;i++){ v1[i]=vi(t); v[i].id=i+1; for(int j=0;j<t;j++){ cin>>v1[i][j]; v[i].solved+=v1[i][j]; if(v1[i][j] == 0){ score[j]++; } } } for(int i=0;i<n;i++){ for(int j=0;j<t;j++){ if(v1[i][j]==1){ v[i].score+=score[j]; } } } sort(v.begin(),v.end(),&compare); for(int i=0;i<n;i++){ if(v[i].id==p){ cout<<v[i].score<<" "<<i+1<<endl; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...