Submission #575409

#TimeUsernameProblemLanguageResultExecution timeMemory
575409SamurajPoi (IOI09_poi)C++14
100 / 100
226 ms16164 KiB
#include <bits/stdc++.h> using namespace std; const int MAX_N = 2007; struct player{ int score{0}; int l_tasks{0}; int id{0}; vector<int> tasks; }; vector<player> gracze; int ile_zrobionych[MAX_N]{}; bool sortowanko(const player& p1,const player& p2){ if(p1.score > p2.score){ return true; } if(p1.score == p2.score){ if(p1.l_tasks > p2.l_tasks){ return true; } if(p1.l_tasks == p2.l_tasks){ if(p1.id < p2.id){ return true; } } } return false; } int main(){ ios::sync_with_stdio(0); cin.tie(); int n,t,p; cin >> n >> t >> p; for(int i = 1; i <= n; i++){ player gracz{}; gracz.id = i; for(int j = 1; j <= t; j++){ int x; cin >> x; if(x == 1){ ile_zrobionych[j]++; gracz.tasks.push_back(j); gracz.l_tasks++; } } gracze.push_back(gracz); } for(int i = 0; i < n; i++){ for(auto j: gracze[i].tasks){ gracze[i].score += n-ile_zrobionych[j]; } } sort(gracze.begin(),gracze.end(),sortowanko); /* for(int i = 1; i<=t; i++){ cout << "task: " << i << " ile_zrobionych: " << ile_zrobionych[i] << '\n'; } for(auto i : gracze){ cout << "id: " << i.id << " score: " << i.score << '\n' ; } */ for(int i = 0; i < n; i++){ if(gracze[i].id == p){ cout << gracze[i].score << ' ' << i+1; break; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...