# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1241063 | badge881 | Poi (IOI09_poi) | C++20 | 218 ms | 16152 KiB |
#include <bits/stdc++.h>
using namespace std;
struct Contestant {
int id;
int score = 0;
int solved = 0;
};
int main() {
int n, t, p;
scanf("%d%d%d",&n,&t,&p);
vector<vector<int>> submissions(n, vector<int>(t));
vector<int> problemWeight(t, 0);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < t; ++j) {
scanf("%d", &submissions[i][j]);
if (submissions[i][j] == 0) {
problemWeight[j]++;
}
}
}
vector<Contestant> contestants(n);
for (int i = 0; i < n; ++i) {
contestants[i].id = i + 1;
for (int j = 0; j < t; ++j) {
if (submissions[i][j] == 1) {
contestants[i].score += problemWeight[j];
contestants[i].solved++;
}
}
}
sort(contestants.begin(), contestants.end(), [](const Contestant& a, const Contestant& b) {
if (a.score != b.score) return a.score > b.score;
if (a.solved != b.solved) return a.solved > b.solved;
return a.id < b.id;
});
for (int rank = 0; rank < n; ++rank) {
if (contestants[rank].id == p) {
printf("%d %d\n", contestants[rank].score, (rank + 1));
break;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |