취직의 염원을 담아서 풀었다
10분컷 했다
import sys
def greedy(sd, N):
ans = 1
current = sd[1]
for i in range(2, N +1):
temp = sd[i]
if temp < current:
ans += 1
current = temp
return ans
T = int(sys.stdin.readline())
for _ in range(T):
N = int(sys.stdin.readline())
scoreData = [0] * (N + 1)
for _ in range(N):
x, y = map(int, sys.stdin.readline().split())
scoreData[x] = y
print(greedy(scoreData, N))
'Algorithm > Greedy' 카테고리의 다른 글
[백준] 11508번 2+1 세일 (0) | 2020.10.20 |
---|---|
[백준] 14241번 슬라임 합치기 (0) | 2020.10.20 |
[백준] 1202번 보석 도둑 (0) | 2020.10.20 |
[백준] 11509번 풍선 맞추기 (0) | 2020.10.19 |
[백준] 1931번 회의실배정 (0) | 2020.10.16 |
댓글