# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
931391 | thisisadarsh | Poi (IOI09_poi) | C++14 | 493 ms | 16156 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 <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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |