# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1103453 |
2024-10-21T03:12:06 Z |
overwatch9 |
Med (COCI22_med) |
C++17 |
|
1 ms |
340 KB |
#include <bits/stdc++.h>
using namespace std;
vector <pair <int, string>> scores;
int main() {
int n;
cin >> n;
map <string, int> mp;
scores.resize(n);
for (int i = 0; i < n; i++) {
string s;
cin >> s;
scores[i].second = s;
mp[s] = i;
for (int j = 0; j < 5; j++) {
int x;
cin >> x;
scores[i].first -= x;
}
}
sort(scores.begin(), scores.end());
vector <int> scores2(n);
for (int i = 0; i < n; i++) {
scores[i].first = -scores[i].first;
scores2[n-i-1] = scores[i].first;
}
vector <pair <int, int>> ans(n);
for (int i = 0; i < n; i++) {
string name = scores[i].second;
int id = mp[name];
ans[id].first = n - (lower_bound(scores2.begin(), scores2.end(), scores[i].first+500) - scores2.begin() - 1);
ans[id].second = n - (upper_bound(scores2.begin(), scores2.end(), scores[i].first-500) - scores2.begin() - 1) - 1;
}
for (int i = 0; i < n; i++)
cout << ans[i].first << ' ' << ans[i].second << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |