#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;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
13 ms |
344 KB |
Output is correct |
6 |
Correct |
24 ms |
348 KB |
Output is correct |
7 |
Correct |
15 ms |
348 KB |
Output is correct |
8 |
Correct |
27 ms |
348 KB |
Output is correct |
9 |
Correct |
7 ms |
348 KB |
Output is correct |