이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<pair<int,string>,int>> bee (n);
for (int i = 0; i < n; ++i) {
cin >> bee[i].first.second;
bee[i].second = i;
for (int j = 0; j < 5; ++j){
int x;
cin >> x;
bee[i].first.first -= x;
}
}
sort (bee.begin(),bee.end());
vector<pair<int,int>> ans (n);
for (int i = 0; i < n; ++i) {
//cout << bee[i].first.first << '\n';
int b = i, w = i;
for (int j = 0; j < i; ++j) {
if (-bee[i].first.first+500 > -bee[j].first.first) {
b = j;
break;
}
if (-bee[i].first.first+500 == -bee[j].first.first and bee[i].first.second < bee[j].first.second) {
b = j;
break;
}
}
for (int j = i+1; j < n; ++j) {
if (-bee[i].first.first < -bee[j].first.first+500) {
w = j;
}
if (-bee[i].first.first-500 == -bee[j].first.first and bee[i].first.second > bee[j].first.second) {
w = j;
}
}
ans[bee[i].second] = {b+1,w+1};
}
for (int i = 0; i < n; ++i) cout << ans[i].first << ' ' << ans[i].second << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |