# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
309348 |
2020-10-03T09:37:12 Z |
BERNARB01 |
Poi (IOI09_poi) |
C++17 |
|
281 ms |
24056 KB |
#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
poi.cpp: In function 'int main()':
poi.cpp:37:20: warning: 'rank' may be used uninitialized in this function [-Wmaybe-uninitialized]
37 | cout << res[rank - 1].first << " " << rank << '\n';
| ~~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
3 ms |
512 KB |
Output is correct |
11 |
Correct |
9 ms |
1152 KB |
Output is correct |
12 |
Correct |
15 ms |
1536 KB |
Output is correct |
13 |
Incorrect |
43 ms |
3832 KB |
Output isn't correct |
14 |
Correct |
60 ms |
5368 KB |
Output is correct |
15 |
Incorrect |
104 ms |
9208 KB |
Output isn't correct |
16 |
Correct |
115 ms |
9976 KB |
Output is correct |
17 |
Correct |
167 ms |
14492 KB |
Output is correct |
18 |
Correct |
192 ms |
16388 KB |
Output is correct |
19 |
Correct |
253 ms |
21880 KB |
Output is correct |
20 |
Correct |
281 ms |
24056 KB |
Output is correct |