# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
670733 | vjudge1 | Poi (IOI09_poi) | C++17 | 201 ms | 9616 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.
// https://oj.uz/problem/view/IOI09_poi?locale=en
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct Contestant {
int id, tasks_solved = 0, score = 0;
vector<int> number_of_task;
};
bool operator<(const Contestant &a, const Contestant &b) {
if (a.score > b.score) return true;
else {
if (a.score < b.score) return false;
else {
if (a.tasks_solved > b.tasks_solved) return true;
else {
if (a.tasks_solved < b.tasks_solved) return false;
else {
if (a.id < b.id) return true;
else return false;
}
}
}
}
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, t, p;
cin >> n >> t >> p;
vector<int> points_by_task(t + 1);
points_by_task.assign(points_by_task.size(), 0);
vector<Contestant> contestants(n);
for (int i = 0; i < n; i++) {
contestants[i].id = i + 1;
for (int j = 0; j < t; j++) {
int x; cin >> x;
if (x == 0) {
points_by_task[j + 1]++;
} else {
contestants[i].tasks_solved++;
contestants[i].number_of_task.push_back(j + 1);
}
}
}
for (Contestant& c : contestants) {
for (const int& num : c.number_of_task)
c.score += points_by_task[num];
}
sort(contestants.begin(), contestants.end());
for (int i = 0; i < n; i++) {
if (contestants[i].id == p) {
cout << contestants[i].score << " " << i + 1;
break;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |