# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
870210 | inawah | Poi (IOI09_poi) | C++14 | 497 ms | 11972 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 <cstdio>
#include <algorithm>
using namespace std;
#define MAXN 2005
int p[MAXN], s[MAXN], t[MAXN], a[MAXN];
bool m[MAXN][MAXN];
bool cmp(int const &i, int const &j) {
if (s[i] != s[j]) {
return s[i] > s[j];
}
if (t[i] != t[j]) {
return t[i] > t[j];
}
return i < j;
}
int main() {
int N, T, P;
scanf("%d %d %d\n", &N, &T, &P);
for (int i = 1; i <= N; ++i) {
for (int j = 1; j <= T; ++j) {
cin >> m[i][j];
p[j] += m[i][j];
t[i] += m[i][j];
}
}
for (int i = 1; i <= N; ++i) {
for (int j = 1; j <= T; ++j) {
s[i] += m[i][j] ? N - p[j] : 0;
}
}
for (int i = 1; i <= N; ++i) {
a[i] = i;
}
sort(a + 1, a + N + 1, &cmp);
for (int i = 1; i <= N; ++i) {
if (a[i] == P) {
printf("%d %d\n", s[P], i);
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |