#pragma GCC optimize("O3")//
#include<bits/stdc++.h>//
#define ll long long
#define endl "\n"
#define AI ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const ll sz=3e5+23;//
bool comp(pair<string,ll>&a,pair<string,ll>&b)
{
if(a.second==b.second)
return a.first<b.first;
return a.second>b.second;
}
void solve()
{
ll n,i,j,x,s;
cin>>n;
string a;
vector<pair<string,ll>>v(n);
for(i=0;i<n;i++)
{
cin>>v[i].first;
v[i].second=0;
for(j=0;j<5;j++)
{
cin>>s;
v[i].second+=s;
}
}
for(i=0;i<n;i++)
{
vector<pair<string,ll>>vc(n);
for(j=0;j<n;j++)
{
vc[j].first=v[j].first;
vc[j].second=v[j].second;
if(i==j)
vc[j].second+=500;
}
sort(vc.begin(),vc.end(),comp);
for(j=0;j<n;j++)
{
if(vc[j].first==v[i].first)
{
cout<<j+1<<' ';
vc[j].second-=500;
continue;
}
vc[j].second+=500;
}
sort(vc.begin(),vc.end(),comp);
for(j=0;j<n;j++)
{
if(vc[j].first==v[i].first)
{
cout<<j+1<<endl;
break;
}
vc[j].second-=500;
}
}
}
int main()
{
AI
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ll t=1;
// cin>>t;
while(t--)
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |