# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
399388 | iulia13 | Poi (IOI09_poi) | C++14 | 708 ms | 16140 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 <iostream>
#include <algorithm>
using namespace std;
const int nmax = 2005;
int a[nmax][nmax];
int v[nmax];
struct ura{
int sc, id, tsk;
};
ura b[nmax];
bool cmp(ura x, ura y)
{
if (x.sc != y.sc)
return x.sc > y.sc;
if (x.tsk != y.tsk)
return x.tsk > y.tsk;
return x.id < y.id;
}
int main()
{
int n, t, p, i, j;
cin >> n >> t >> p;
for (i = 1; i <= n; i++)
for (j = 1; j <= t; j++)
cin >> a[i][j], b[i].tsk += a[i][j];
for (j = 1; j <= t; j++)
for (i = 1; i <= n; i++)
v[j] += (1 - a[i][j]);
for (i = 1; i <= n; i++)
{
b[i].id = i;
for (j = 1; j <= t; j++)
b[i].sc += a[i][j] * v[j];
}
sort (b + 1, b + n + 1, cmp);
for (i = 1; i <= n; i++)
if (b[i].id == p)
{
cout << b[i].sc << " " << i;
return 0;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |