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 int ll
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define RREP(i, n) for (int i=(n)-1; i>=0; i--)
#define pii pair<int, int>
#define psi pair<string, int>
#define f first
#define s second
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
int n;
bool cmp (psi a, psi b){
if (a.s == b.s) return a.f<b.f;
return a.s>b.s;
}
vector<psi> vc;
void inp(){
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin>>n;
vc=vector<psi> (n);
REP(i, n){
cin>>vc[i].f;
REP(j, 5){
int x; cin>>x;
vc[i].s+=x;
}
}
}
void solve(){
REP(i, n){
vector<psi> tmp = vc, tmp2 = vc;
int l, r;
tmp[i].s+=500;
tmp2[i].s-=500;
sort(ALL(tmp), cmp);
sort(ALL(tmp2), cmp);
REP(j, n){
if (vc[i].f == tmp[j].f) l=j+1;
}
REP(j, n){
if(vc[i].f == tmp2[j].f) r=j+1;
}
cout<<l<<' '<<r<<endl;
}
}
signed main(){
inp();
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |