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 int long long
#define OYY 1000000005
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mid (start+end)/2
#define mod 1000000007
vector <pair<int,string>> v;
int32_t main(){
faster
int n;cin>>n;
for(int i=0;i<n;i++){
string s;cin>>s;
int deg,sum=0;
for(int j=0;j<5;j++){
cin>>deg;
sum+=deg;
}
v.push_back({-sum,s});
}
for(int i=0;i<n;i++){
vector <pair<int,string>> deg=v;
string isim=deg[i].second;
for(int j=0;j<n;j++){
if(deg[j].second==isim){
deg[j].first-=500;
}
}
sort(deg.begin(),deg.end());
// reverse(deg.begin(),deg.end());
for(int j=0;j<n;j++){
if(deg[j].second==isim){
cout<<j+1<<" ";
}
}
for(int j=0;j<n;j++){
if(isim==deg[j].second){
deg[j].first+=500;
}
else deg[j].first-=500;
}
sort(deg.begin(),deg.end());
// reverse(deg.begin(),deg.end());
for(int j=0;j<n;j++){
if(deg[j].second==isim){
cout<<j+1<<'\n';
}
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |