# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
489411 | Alexandruabcde | Poi (IOI09_poi) | C++14 | 301 ms | 16132 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;
constexpr int NMAX = 2005;
int N, T, P;
int mat[NMAX][NMAX];
int cnt[NMAX];
int value[NMAX];
int main () {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> N >> T >> P;
for (int i = 1; i <= N; ++ i )
for (int j = 1; j <= T; ++ j ) {
cin >> mat[i][j];
cnt[i] += mat[i][j];
}
for (int j = 1; j <= T; ++ j ) {
int val = 0;
for (int i = 1; i <= N; ++ i )
val += (1 - mat[i][j]);
for (int i = 1; i <= N; ++ i )
value[i] += val * mat[i][j];
}
int pos = 0;
for (int i = 1; i <= N; ++ i ) {
if (value[i] > value[P]) ++ pos;
else if (value[i] == value[P] && i != P && (cnt[i] > cnt[P] || (cnt[i] == cnt[P] && i < P)))
++ pos;
}
cout << value[P] << " " << pos+1 << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |