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;
int main(){
int n;
cin >> n;
vector<pair<int, string>> vec;
for (int i = 0; i < n; i ++){
string s;
cin >> s;
int sm = 0;
for (int j = 0; j < 5; j ++){
int x;
cin >> x;
sm += x;
}
vec.push_back({-sm, s});
}
for (int i = 0; i < n; i ++){
vector<pair<int, string>> tmp;
for (int j = 0; j < i; j ++)
tmp.push_back(vec[j]);
tmp.push_back({vec[i].first - 500, vec[i].second});
for (int j = i + 1; j < n; j ++)
tmp.push_back(vec[j]);
sort(tmp.begin(), tmp.end());
int pos = -1;
for (int j = 0; j < n; j ++){
if (tmp[j].second == vec[i].second){
pos = j + 1;
break;
}
}
cout << pos << " ";
tmp.clear();
for (int j = 0; j < i; j ++)
tmp.push_back({vec[j].first - 500, vec[j].second});
tmp.push_back(vec[i]);
for (int j = i + 1; j < n; j ++)
tmp.push_back({vec[j].first - 500, vec[j].second});
sort(tmp.begin(), tmp.end());
pos = -1;
for (int j = 0; j < n; j ++){
if (tmp[j].second == vec[i].second){
pos = j + 1;
break;
}
}
cout << pos << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |