#29 백준 7568번 파이썬
우보만리
- 문제에서 덩치 등수를 결정하는 방법을 명시적으로
더 큰 덩치의 사람이 k 명일 때 k+1등
이라고 설명 - 덩치가 더 큰사람의 수를 나타내는 list를 새로 만들어 해결
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
T = int(input()) | |
people = [0] * T | |
k = [1] * T | |
for i in range(T): | |
people[i] = tuple(map(int, sys.stdin.readline().split())) | |
for i in range(T): | |
ref = people[i] | |
for j in range(i+1,T): | |
counter = people[j] | |
if ref[0] > counter[0] and ref[1] > counter[1]: | |
k[j] += 1 | |
elif ref[0] < counter[0] and ref[1] < counter[1]: | |
k[i] += 1 | |
else : | |
pass | |
print(' '.join(list(map(str,k)))) |