7568_덩치

minjun kim·2024년 4월 25일

참고

https://bgspro.tistory.com/61

문제

https://www.acmicpc.net/status?user_id=big9810&problem_id=7568&from_mine=1

풀이

t = int(input())
ns = [list(map(int,input().split())) for _ in range(t)]
ans = []

for i in range(t):
    cnt = 0
    for j in range(t):
        if ns[i][0] < ns[j][0] and ns[i][1] < ns[j][1]: 
            cnt += 1
    ans.append(cnt+1)

for i in ans:
    print(i, end=" ")

처음에는 각 enumerate로 값 랭킹을 매겨서 앞 순번의 합을 더해줘서 어렵게 생각하고 풀이를 작성해보려고 노력해봤는데 이런 좋은 방식이 있었다.

profile
배움의 흔적을 남기고 싶습니다.

0개의 댓글