#include<bits/stdc++.h>
#define int long long
#define forn(i,n) for(int i = 0;i < n;i++)
#define Forn(i,n) for(int i = 1;i <= n;i++)
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define all(p) p.begin(),p.end()
#define F first
#define S second
using namespace std;
void debug() {cerr << endl;}
template <class T, class ...U> void debug(T a, U ... b) { cerr << a << " "; debug(b...);}
const int INF = 1e13 + 10;
const int MOD = (int) 998244353;
const int N = 509;
int n;
int cmp = 0;
struct pp{
int s;
string name;
};
void solve(){
// pancake ( ^-^)_
cin >> n;
string s;
vector<pp> ori(n);
forn(i,n){
int t = 0,ss = 0;
cin >> s;
forn(i,5) cin >> t,ss += t;
ori[i] = {ss,s};
}
forn(i,n){
vector<pp> u = ori;
//
forn(j,n){
if(i != j) u[j].s += 0;
else u[j].s += 500;
}
sort(all(u),[](pp a,pp b){
return a.s > b.s || (a.s == b.s && a.name < b.name);
});
forn(j,n){
if(u[j].name == ori[i].name) cout << j + 1 << ' ';
}
u = ori;
forn(j,n){
if(i != j) u[j].s += 500;
}
sort(all(u),[](pp a,pp b){
return a.s > b.s || (a.s == b.s && a.name < b.name);
});
forn(j,n) if(u[j].name == ori[i].name) cout << j + 1 << ' ' ;
u = ori;
cout << '\n';
}
}
signed main(){
cin.tie(NULL);
cout.tie(NULL);
ios_base::sync_with_stdio(0);
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
69 ms |
336 KB |
Output is correct |
6 |
Correct |
131 ms |
340 KB |
Output is correct |
7 |
Correct |
85 ms |
340 KB |
Output is correct |
8 |
Correct |
148 ms |
340 KB |
Output is correct |
9 |
Correct |
39 ms |
316 KB |
Output is correct |