Submission #489560

#TimeUsernameProblemLanguageResultExecution timeMemory
489560shauryatuli9Poi (IOI09_poi)C++14
0 / 100
642 ms19060 KiB
#include <bits/stdc++.h> using namespace std; // globals vector<int> probSolv, solPerProb, points; bool comp(int i, int j) { if (points[i] > points[j]) return true; else if (points[i] < points[j]) return false; else if (probSolv[i] > probSolv[j]) return true; else if (probSolv[i] < probSolv[j]) return false; else return (i > j); } void sortPlayers(vector<vector<int>>& table, vector<int>& players) { int T = (int)table[0].size(), N = (int)table.size(); // this could have been players.size() as well for (int i = 0; i < T; i++) { for (int j = 0; j < N; j++) if (table[j][i]) solPerProb[i]++; } for (int i = 0; i < N; i++) { for (int j = 0; j < T; j++) { if (table[i][j]) { points[i] += (N - solPerProb[j]); probSolv[i]++; } } } sort(players.begin(), players.end(), comp); } int main() { int N, T, P; cin >> N >> T >> P; vector<vector<int>> table(N, vector<int>(T)); // N x T table; vector<int> players(N); probSolv.assign(N, 0); solPerProb.assign(T, 0); points.assign(N, 0); for (int i = 0; i < N; i++) { players[i] = i; // assigning ids for (int j = 0; j < T; j++) cin >> table[i][j]; } sortPlayers(table, players); for (int i = 0; i < N; i++) { if (players[i] == P - 1) { } } }
#Verdict Execution timeMemoryGrader output
Fetching results...