from functools import cmp_to_key
def cmp(x, y):
if x[0] == y[0]:
return [1, -1][x[1] < y[1]]
return [-1, 1][x[0] < y[0]]
n = int(input())
m = []
for i in range(n):
l = input().split()
m.append([sum(map(int, l[1:])), l[0]])
for i in range(n):
x = m[:]
m[i][0]+=500
x.sort(key=lambda x: x[1])
x.sort(key=lambda x: x[0], reverse=True)
print(x.index(m[i])+1, end=' ')
y = m[:]
m[i][0]-=2*500
y.sort(key=lambda x: x[1])
y.sort(key=lambda x: x[0], reverse=True)
print(y.index(m[i])+1)
m[i][0]+=500
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
44 ms |
18848 KB |
Output is correct |
2 |
Correct |
50 ms |
18804 KB |
Output is correct |
3 |
Correct |
50 ms |
18812 KB |
Output is correct |
4 |
Correct |
44 ms |
18732 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
44 ms |
18848 KB |
Output is correct |
2 |
Correct |
50 ms |
18804 KB |
Output is correct |
3 |
Correct |
50 ms |
18812 KB |
Output is correct |
4 |
Correct |
44 ms |
18732 KB |
Output is correct |
5 |
Correct |
324 ms |
22232 KB |
Output is correct |
6 |
Correct |
699 ms |
25684 KB |
Output is correct |
7 |
Correct |
429 ms |
22996 KB |
Output is correct |
8 |
Correct |
732 ms |
26052 KB |
Output is correct |
9 |
Correct |
331 ms |
20676 KB |
Output is correct |