# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
767909 | benjaminkleyn | Poi (IOI09_poi) | C++17 | 225 ms | 4372 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;
typedef long long ll;
#define mp make_pair
int N, T, P;
bool solved[2000][2000];
int value[2000] = {0};
int score[2000] = {0};
int num_solved[2000] = {0};
int rankings[2000];
int main()
{
cin.tie(0)->sync_with_stdio(0);
cin >> N >> T >> P;
for (int i = 0; i < N; i++)
for (int j = 0; j < T; j++)
{
cin >> solved[i][j];
if (!solved[i][j])
value[j]++;
}
for (int i = 0; i < N; i++)
for (int j = 0; j < T; j++)
if (solved[i][j])
score[i] += value[j], num_solved[i]++;
iota(rankings, rankings + N, 0);
sort(rankings, rankings + N, [] (const int &x, const int &y) {return mp(score[x], mp(num_solved[x], -x)) > mp(score[y], mp(num_solved[y], -y));});
cout << score[P - 1] << ' ';
for (int i = 0; i < N; i++)
if (rankings[i] == P - 1)
return cout << i + 1 << '\n', 0;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |