# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
252339 | SamAnd | Poi (IOI09_poi) | C++17 | 452 ms | 23892 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;
const int N = 2003;
struct ban
{
int i, q, s;
ban()
{
i = q = s = 0;
}
};
bool operator<(const ban& a, const ban& b)
{
if (a.s > b.s)
return true;
if (a.s < b.s)
return false;
if (a.q > b.q)
return true;
if (a.q < b.q)
return false;
return a.i < b.i;
}
int n, m, p;
int a[N][N];
int u[N];
ban b[N];
int main()
{
#ifdef SOMETHING
freopen("input.txt", "r", stdin);
#endif // SOMETHING
scanf("%d%d%d", &n, &m, &p);
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= m; ++j)
scanf("%d", &a[i][j]);
}
for (int j = 1; j <= m; ++j)
u[j] = n;
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= m; ++j)
u[j] -= a[i][j];
}
for (int i = 1; i <= n; ++i)
{
b[i].i = i;
for (int j = 1; j <= m; ++j)
{
b[i].q += a[i][j];
if (a[i][j])
b[i].s += u[j];
}
}
sort(b + 1, b + n + 1);
for (int i = 1; i <= n; ++i)
{
if (b[i].i == p)
{
printf("%d %d\n", b[i].s, i);
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |