Submission #931391

#TimeUsernameProblemLanguageResultExecution timeMemory
931391thisisadarshPoi (IOI09_poi)C++14
70 / 100
493 ms16156 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int N, T, P; cin >> N >> T >> P; vector<vector<int>> solved(N, vector<int>(T)); // Read which tasks were solved by each contestant for (int i = 0; i < N; ++i) { for (int j = 0; j < T; ++j) { cin >> solved[i][j]; } } vector<int> scores(N, 0); // Calculate scores for each contestant for (int j = 0; j < T; ++j) { int unsolved = 0; // Number of contestants who didn't solve this task for (int i = 0; i < N; ++i) { if (solved[i][j] == 0) { unsolved++; } } for (int i = 0; i < N; ++i) { if (solved[i][j] == 1) { scores[i] += unsolved; } } } // Find Philip's score int philip_score = scores[P - 1]; // Find Philip's rank int philip_rank = 1; for (int i = 0; i < N; ++i) { if (scores[i] > philip_score || (scores[i] == philip_score && i < P - 1)) { philip_rank++; } } cout << philip_score << " " << philip_rank << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...