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;
#define ll long long
#define f first
#define s second
#define all(x) x.begin(),x.end()
int main(){
int n;
cin>>n;
vector< pair< pair<int,string>, int> > vec;
for(int i=0;i<n;i++){
int a,b,c,d,e;
string S;
cin>>S;
for(auto &c:S){
c='z'-c;
}
cin>>a>>b>>c>>d>>e;
vec.push_back({{a+b+c+d+e,S},i});
}
sort(all(vec),greater<pair<pair<int,string>,int>>());
pair<int,int> ans[n];
for(int i=0;i<n;i++){
int sum=vec[i].f.f;
string S=vec[i].f.s;
int id=vec[i].s;
pair<pair<int,string>,int> cur={{sum+500,S},id};
ans[id].f=(lower_bound(all(vec),cur,greater<pair<pair<int,string>,int>>())-vec.begin())+1;
cur.f.f-=1000;
ans[id].s=(lower_bound(all(vec),cur,greater<pair<pair<int,string>,int>>())-vec.begin());
}
for(int i=0;i<n;i++){
cout<<ans[i].f<<' '<<ans[i].s<<'\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |