#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<pair<string, int>> a;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
vector<int> p(5);
for (int &j : p) cin >> j;
a.emplace_back(s, accumulate(p.begin(), p.end(), 0));
}
for (int i = 0; i < n; i++) {
{
vector<pair<int, string>> st;
for (int j = 0; j < n; j++) {
if (j == i) {
st.emplace_back(-a[j].second - 500, a[j].first);
}
else {
st.emplace_back(-a[j].second, a[j].first);
}
}
sort(st.begin(), st.end());
for (int j = 0; j < n; j++) {
if (st[j].second == a[i].first) {
cout << j + 1 << ' ';
break;
}
}
}
{
vector<pair<int, string>> st;
for (int j = 0; j < n; j++) {
if (j == i) {
st.emplace_back(-a[j].second, a[j].first);
}
else {
st.emplace_back(-a[j].second - 500, a[j].first);
}
}
sort(st.begin(), st.end());
for (int j = 0; j < n; j++) {
if (st[j].second == a[i].first) {
cout << j + 1 << '\n';
break;
}
}
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |