// In the name of God
// Hope is last to die
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define pb push_back
// #define int long long
#define S second
#define F first
#define mp make_pair
#define smax(x, y) (x) = max((x), (y))
#define smin(x, y) (x) = min((x), (y))
#define all(x) (x).begin(), (x).end()
#define len(x) ((int)(x).size())
const int maxn = 500 + 5;
const int inf = 1e9 + 7;
int n, a[maxn];
vector<pii> b;
bool cmp(pii x, pii y){
if(x.F == y.F) return x.S < y.S;
return x.F > y.F;
}
int32_t main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
for(int i = 0; i < n; i++){
string s; cin >> s;
for(int j = 0; j < 5; j++){
int v; cin >> v;
a[i] += v;
}
}
for(int i = 0; i < n; i++){
b.clear();
for(int j = 0; j < n; j++){
if(i == j) continue;
b.pb(mp(a[j], j));
}
b.pb(mp(a[i] + 500, i));
sort(all(b), cmp);
for(int j = 0; j < n; j++){
if(b[j].S == i){
cout << j + 1 << ' ';
break;
}
}
b.clear();
for(int j = 0; j < n; j++){
if(i == j) continue;
b.pb(mp(a[j] + 500, j));
}
b.pb(mp(a[i], i));
sort(all(b), cmp);
for(int j = 0; j < n; j++){
if(b[j].S == i){
cout << j + 1 << '\n';
break;
}
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |