[SWEA] 5203 베이비진 게임

김은서·2021년 10월 6일
0

SWEA

목록 보기
46/47

Python Code

T = int(input())
for tc in range(1, T+1):
    N = int(input())
    time = []
    checked = [0 for _ in range(25)]
    total = 0
    for _ in range(N):
        s, e = map(int, input().split())
        time.append((e-s, s, e))
    time.sort()
    for j in time:
        check = 0
        for i in range(j[1], j[2]):
            if checked[i] == 0:
                checked[i] = 1
                check += 1
            else:
                break
        if check == j[0]:
            total += 1
    print('#{} {}'.format(tc, total))
profile
Gracelog

0개의 댓글