www.acmicpc.net/problem/2628 import sys input = sys.stdin.readline #sys.stdin = open(".idea/inputs/2628_input1.txt") width, height = map(int, input().split()) width_cut=[0] height_cut=[0] n = int(input()) for _ in range(n): direction, nth = map(int, input().split()) if direction: # 세로 width_cut.append(nth) else: #가로 height_cut.append(nth) width_cut.append(width) width_cut.sort() height_cut.appen..