이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |