# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
979088 | Sandarach151 | Med (COCI22_med) | C++17 | 0 ms | 0 KiB |
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 <iostream>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<pair<int, string> > score(n);
vector<pair<int, string> > arr(n);
for(int i=0; i<n; i++){
cin >> score[i].second;
score[i].first = 0;
for(int j=0; j<5; j++){
int a;
cin >> a;
score[i].first -= a;
}
arr[i] = score[i];
}
sort(score.begin(), score.end());
for(int i=0; i<n; i++){
int minpos = lower_bound(score.begin(), score.end(), make_pair(arr[i].first-500, arr[i].second))-score.begin();
int maxpos = lower_bound(score.begin(), score.end(), make_pair(arr[i].first+500, arr[i].second))-score.begin();
cout << minpos+1 << ' ' << maxpos << '\n';
}
return 0;
}