# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
717698 | EntityPlantt | Poi (IOI09_poi) | C++14 | 327 ms | 9968 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 <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
int main() {
int n, t, p, i, j, x;
scanf("%d%d%d", &n, &t, &p);
std::vector <int> solved[n], score(t, n), final(n, 0);
int ppl[n];
for (i = 0; i < n; i++) {
ppl[i] = i;
for (j = 0; j < t; j++) {
scanf("%d", &x);
if (x) {
solved[i].push_back(j);
score[j]--;
}
}
}
for (i = 0; i < n; i++) {
for (j = 0; j < solved[i].size(); j++) {
final[i] += score[solved[i][j]];
}
}
std::sort(ppl, ppl + n, [&](int a, int b) {
if (final[a] != final[b]) return final[a] > final[b];
if (solved[a].size() != solved[b].size()) return solved[a].size() > solved[b].size();
return a < b;
});
p--;
/* for (i = 0; i < n; i++) {
if (ppl[i] == p) {
printf(">%3d", i + 1);
}
else {
printf("%4d", i + 1);
}
printf(" | Contestant #%d, Total: %d, Solved tasks: %d\n", ppl[i] + 1, final[ppl[i]], solved[ppl[i]].size());
} */
printf("%d %d", final[p], std::distance(ppl - 1, std::find(ppl, ppl + n, p)));
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |