-
[백준] 10431. 줄세우기코테 준비/구현 2024. 2. 8. 13:58
난이도 쉬운편. 단순 구현
p=int(input()) answer=[] for i in range(p): cnt = 0 heights = [] h=list(map(int,input().split())) heights.append(h[1]) for j in range(2,21): if h[j]<max(heights): for idx,k in enumerate(heights): if k>h[j]: heights.insert(idx,h[j]) cnt+=len(heights)-idx-1 break else: heights.append(h[j]) answer.append((h[0],cnt)) for a,b in answer: print(a,b)
'코테 준비 > 구현' 카테고리의 다른 글
[백준] 8979. 올림픽 (0) 2024.02.08 프로그래머스_삼각달팽이 (0) 2023.12.09 재귀_하노이의 탑 알고리즘 (1) 2023.12.08 [백준] 1916. 최소비용 구하기 (다익스트라 알고리즘) (0) 2023.10.13 [프로그래머스] 셔틀버스 (0) 2023.03.02