# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
309879 | Temmie | Poi (IOI09_poi) | C++17 | 337 ms | 9752 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 <bits/stdc++.h>
int n, t, p;
struct C {
int id;
int point = 0;
std::vector <int> solve;
bool operator<(const C& other) const {
if (point == other.point) {
if (solve.size() == other.solve.size()) return id < other.id;
return solve.size() > other.solve.size();
}
return point > other.point;
}
};
std::vector <int> task;
std::vector <C> c;
int main() {
std::ios::sync_with_stdio(0); std::cin.tie(0);
std::cin >> n >> t >> p;
task.resize(t, 0);
c.resize(n);
for (int i = 0; i < n; i++) {
c[i].id = i;
for (int j = 0; j < t; j++) {
bool now; std::cin >> now;
task[j] += now;
if (now) c[i].solve.push_back(j);
}
}
for (int i = 0; i < t; i++) {
task[i] = n - task[i];
}
for (int i = 0; i < n; i++) {
for (int x : c[i].solve) {
c[i].point += task[x];
}
}
std::sort(c.begin(), c.end());
for (int i = 0; i < n; i++) {
if (c[i].id == p - 1) {
std::cout << c[i].point << " " << i + 1 << "\n";
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |