제출 #541953

#제출 시각아이디문제언어결과실행 시간메모리
541953DemonLord154Poi (IOI09_poi)C++14
100 / 100
605 ms15968 KiB
#include<iostream> #include<vector> #include<bits/stdc++.h> using namespace std; struct Player{ int score; int id; int probSolved; }; bool comparator(Player player1,Player player2){ if (player1.score != player2.score){ return player1.score<player2.score; } if (player1.probSolved!= player2.probSolved){ return player1.probSolved < player2.probSolved; } return player1.id>player2.id; } int main(){ int n,t,p; cin>>n>>t>>p; vector<Player> players(n); int scores[n][t]; for (int i=0;i<n;i++){ for (int j=0;j<t;j++){ cin>>scores[i][j]; } } vector<int> eachTestScore(t); for (int i=0;i<t;i++){ int score=0; for (int j=0;j<n;j++){ if (scores[j][i]==0){ score++; } } eachTestScore[i]=score; } for (int i=0;i<n;i++){ int playerScore=0,probsolved=0; for (int j=0;j<t;j++){ if (scores[i][j]==1){ playerScore+=eachTestScore[j]; probsolved++; } } players[i].score=playerScore; players[i].id=i; players[i].probSolved=probsolved; } sort(players.begin(),players.end(),comparator); for (int i=0;i<n;i++){ if (players[i].id==p-1){ cout<<players[i].score<<" "<<n-i<<endl; break; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...