Submission #704850

#TimeUsernameProblemLanguageResultExecution timeMemory
704850guagua0407Med (COCI22_med)C++17
50 / 50
1 ms340 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...