# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
562935 | Drew_ | Poi (IOI09_poi) | C++17 | 289 ms | 4908 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 pb push_back
const int MAX = 2069;
int N, M, P;
bool ar[MAX][MAX];
int score[MAX];
int main()
{
ios :: sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N >> M >> P;
for (int j = 1; j <= M; ++j)
score[j] = N;
for (int i = 1; i <= N; ++i)
{
for (int j = 1; j <= M; ++j)
{
cin >> ar[i][j];
score[j] -= ar[i][j];
}
}
vector<array<int, 3>> v;
for (int i = 1; i <= N; ++i)
{
int sum = 0, solved = 0;
for (int j = 1; j <= M; ++j)
if (ar[i][j])
sum += score[j], solved++;
v.pb({sum, solved, -i});
}
sort(v.rbegin(), v.rend());
for (int i = 0; i < N; ++i)
{
if (-v[i][2] == P)
{
cout << v[i][0] << " " << i+1 << '\n';
break;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |