# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
524306 | itachi | Poi (IOI09_poi) | C++14 | 253 ms | 15680 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<map>
#include<algorithm>
#include<iomanip>
using namespace std;
struct player {
int id;
int tasks;
int points;
string doneTasks = "";
player(int id, int tasks, int points) {
this->id = id;
this->tasks = tasks;
this->points = points;
}
friend bool operator < (player a, player b) {
if(a.points == b.points) {
if(a.tasks == b.tasks) {
return a.id < b.id;
}
return a.tasks > b.tasks;
}
return a.points > b.points;
}
};
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<player> players(n,player(0,0,0));
int t,k;
cin >> t >> k;
vector<int> tasks(t,0);
for(int i = 0; i < n; i++) {
for (int j = 0; j < t; j++)
{
int l;
cin >> l;
tasks[j] += l;
players[i].doneTasks += (l?'1':'0');
players[i].id = i;
players[i].tasks += l;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<t;j++){
if(players[i].doneTasks[j] == '1'){
players[i].points += (n-tasks[j]);
}
}
}
sort(players.begin(), players.end());
for(int i=0;i<n;i++){
if(players[i].id+1 == k){
cout << players[i].points << " " << i+1 << endl;
break;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |