https://codeup.kr/problem.php?id=6097
입력 예시
5 5
3
2 0 1 1
3 1 2 3
4 1 2 5
출력 예시
1 1 0 0 0
0 0 1 0 1
0 0 1 0 1
0 0 1 0 1
0 0 0 0 1
python
import sys
input = sys.stdin.readline
N, M = map(int, input().rstrip().split())
mtx = [[0]*M for _ in range(N)]
num = int(input().rstrip())
for _ in range(num):
l, a, n, m = map(int, input().rstrip().split())
if a == 0:
for i in range(l) :
if m-1+i <= M:
mtx[n-1][m-1+i] = 1
else:
for i in range(l):
if n-1+i <= N:
mtx[n-1+i][m-1] = 1
for i in range(N):
for j in range(M):
print(mtx[i][j], end=" ")
print()