# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
851770 | lovrot | Poi (IOI09_poi) | C++17 | 258 ms | 20208 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 <cstdio>
#include <algorithm>
using namespace std;
const int N = 2010;
int n, m, p, B[N][N];
int SO[N], SC[N], AC[N];
int I[N];
int main() {
scanf("%d%d%d", &n, &m, &p);
for(int i = 0; i < n; ++i)
for(int j = 0; j < m; ++j) {
scanf("%d", &B[i][j]);
SO[j] += B[i][j];
AC[i] += B[i][j];
}
for(int i = 0; i < n; ++i) {
I[i] = i;
for(int j = 0; j < m; ++j) SC[i] += B[i][j] * (n - SO[j]);
}
sort(I, I + n, [](int a, int b) {
return SC[a] > SC[b] || (SC[a] == SC[b] && AC[a] > AC[b]) || (SC[a] == SC[b] && AC[a] == AC[b] && a < b);
});
printf("%d ", SC[p - 1]);
for(int i = 0; i < n; ++i)
if(I[i] == p - 1) printf("%d\n", i + 1);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |