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>
#define fast cin.tie(0)->sync_with_stdio(0);
#define int long long
#define inf ((int)1e18)
using namespace std;
int32_t main(){
fast
int n;
cin >> n;
vector <pair<int, string> > v(n);
for(int i = 0; i < n; i++) {
cin >> v[i].second;
for(auto &it:v[i].second) {
it = 'z' - it + 'a';
}
int sum = 0;
for(int j = 0; j < 5; j++) {
int in;
cin >> in;
sum += in;
}
v[i].first = sum;
}
auto worst = v;
auto best = v;
for(auto &it:best) {
it.first += 500;
}
sort(worst.begin(), worst.end());
sort(best.begin(), best.end());
for(auto it:v) {
// for worst
pair<int, int> find;
find.second = n - (upper_bound(best.begin(), best.end(), it) - best.begin());
// for best
it.first += 500;
find.first = n - (upper_bound(worst.begin(), worst.end(), it) - worst.begin()) + 1;
cout << find.first << " " << find.second << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |