# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
309348 | BERNARB01 | Poi (IOI09_poi) | C++17 | 281 ms | 24056 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;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, t, p;
cin >> n >> t >> p;
vector<long long> score(t, n);
vector<pair<long long, int>> res(n);
for (int i = 0; i < n; i++) {
res[i].second = i;
}
vector<vector<int>> solved(n, vector<int>(t));
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
cin >> solved[i][j];
score[j] -= solved[i][j];
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
res[i].first += score[j] * solved[i][j];
}
}
sort(res.begin(), res.end(), [&](const pair<long long, int>& a, const pair<long long, int>& b) {
return (a.first == b.first ? a.second < b.second : a.first > b.first);
});
int rank;
for (int i = 0; i < n; i++) {
if (res[i].second == p - 1) {
rank = i + 1;
break;
}
}
cout << res[rank - 1].first << " " << rank << '\n';
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |