Submission #524306

#TimeUsernameProblemLanguageResultExecution timeMemory
524306itachiPoi (IOI09_poi)C++14
100 / 100
253 ms15680 KiB
#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 timeMemoryGrader output
Fetching results...