# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
309352 |
2020-10-03T09:44:13 Z |
BERNARB01 |
Poi (IOI09_poi) |
C++17 |
|
283 ms |
31852 KB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
long long n, t, p;
cin >> n >> t >> p;
vector<long long> score(t, n);
vector<pair<long long, pair<long long, long long>>> res(n);
for (long long i = 0; i < n; i++) {
res[i].second.second = i;
}
vector<vector<long long>> solved(n, vector<long long>(t));
for (long long i = 0; i < n; i++) {
for (long long j = 0; j < t; j++) {
cin >> solved[i][j];
score[j] -= solved[i][j];
res[i].second.first += solved[i][j];
}
}
for (long long i = 0; i < n; i++) {
for (long long j = 0; j < t; j++) {
res[i].first += score[j] * solved[i][j];
}
}
sort(res.begin(), res.end(), [&](const pair<long long, pair<long long, long long>>& a, const pair<long long, pair<long long, long long>>& b) {
return (a.first == b.first ? (a.second.first == b.second.first ? a.second.second < b.second.second : a.second.first > b.second.first) : a.first > b.first);
});
long long rank = 1;
for (long long i = 0; i < n; i++) {
if (res[i].second.second == p - 1) {
rank = i + 1;
break;
}
}
cout << res[rank - 1].first << " " << rank << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
512 KB |
Output is correct |
10 |
Correct |
3 ms |
512 KB |
Output is correct |
11 |
Correct |
9 ms |
1280 KB |
Output is correct |
12 |
Correct |
15 ms |
2000 KB |
Output is correct |
13 |
Correct |
44 ms |
4992 KB |
Output is correct |
14 |
Correct |
61 ms |
7040 KB |
Output is correct |
15 |
Correct |
108 ms |
12160 KB |
Output is correct |
16 |
Correct |
116 ms |
13184 KB |
Output is correct |
17 |
Correct |
174 ms |
19320 KB |
Output is correct |
18 |
Correct |
195 ms |
21760 KB |
Output is correct |
19 |
Correct |
254 ms |
28720 KB |
Output is correct |
20 |
Correct |
283 ms |
31852 KB |
Output is correct |