정렬

2109번 – 순회강연

2

문제 풀이 코드 n = int(input()) pds = [] maxD = 0 for _ in range(n): p, d = map(int ,input().split()) pds.append((p, d)) maxD = max(maxD, d) def answer(): global pds, maxD pds = sorted(pds, reverse=True) memo = [0]*(maxD+1) count, fullCount = (0, len(memo)) for i in range(len(pds)): p, d = pds[i] if memo[d] == 0: memo[d] = p count += 1 else: for underD in range(d-1, 0, -1): if memo[underD] == 0:...