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 ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define endl '\n'
#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound
#define rep(x,s,e) for (auto x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
int n;
string s[505];
int arr[505][5];
int brr[505];
signed main(){
cin.tie(0);
cout.tie(0);
cin.sync_with_stdio(false);
cin>>n;
rep(x,0,n){
cin>>s[x];
rep(y,0,5) cin>>arr[x][y];
rep(y,0,5) brr[x]+=arr[x][y];
}
vector<int> idx;
rep(x,0,n) idx.pub(x);
//rep(x,0,n) cout<<brr[x]<<" "; cout<<endl;
rep(x,0,n){
brr[x]+=500;
sort(all(idx),[](int i,int j){
if (brr[i]!=brr[j]) return brr[i]>brr[j];
else return s[i]<s[j];
});
rep(y,0,n) if (idx[y]==x) cout<<y+1<<" ";
brr[x]-=1000;
sort(all(idx),[](int i,int j){
if (brr[i]!=brr[j]) return brr[i]>brr[j];
else return s[i]<s[j];
});
rep(y,0,n) if (idx[y]==x) cout<<y+1<<endl;
brr[x]+=500;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |