# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
703275 | finn__ | Poi (IOI09_poi) | C++17 | 574 ms | 8712 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>
using namespace std;
#define N 2000
bitset<N> solved[N];
unsigned num_solved[N], contestant_num_solved[N], score[N], ranking[N];
bool compare_contestant(unsigned a, unsigned b)
{
if (score[a] == score[b])
{
if (contestant_num_solved[a] == contestant_num_solved[b])
return a < b;
return contestant_num_solved[a] > contestant_num_solved[b];
}
return score[a] > score[b];
}
int main()
{
size_t n, t, p;
cin >> n >> t >> p;
for (size_t i = 0; i < n; i++)
{
for (size_t j = 0; j < t; j++)
{
unsigned x;
cin >> x;
solved[i][j] = x;
contestant_num_solved[i] += x;
num_solved[j] += x;
}
ranking[i] = i;
}
for (size_t i = 0; i < n; i++)
for (size_t j = 0; j < t; j++)
if (solved[i][j])
score[i] += n - num_solved[j];
sort(ranking, ranking + n, compare_contestant);
for (size_t i = 0; i < n; i++)
if (ranking[i] + 1 == p)
cout << score[p - 1] << ' ' << i + 1 << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |