Submission #572584

# Submission time Handle Problem Language Result Execution time Memory
572584 2022-06-04T17:55:20 Z model_code Med (COCI22_med) PyPy 3
50 / 50
732 ms 26052 KB
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
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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