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;
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |