# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
541953 | DemonLord154 | Poi (IOI09_poi) | C++14 | 605 ms | 15968 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |