import sys
input = sys.stdin.readline
N,M = map(int,input().split())
arr = list(map(int,input().split()))
cnt = [0]*(N+1)
for _ in range(M):
command,x,y = map(int,input().split())
x -= 1
if command == 1:
arr[x] = y
elif command == 2:
y -= 1
for ind in range(x,y+1):
arr[ind] = (arr[ind]+1)%2
elif command == 3:
y-=1
for ind in range(x,y+1):
arr[ind] = 0
else:
y -= 1
for ind in range(x,y+1):
arr[ind] = 1
print(*arr)

 

 

이 문제는 문제에 주어진 조건대로 배열의 상태를 바꿔주면 되는 문제였다. 

 

전체 배열의 크기가 4000이고, 최대 명령이 4000이라,

 

최악의 경우라 해도 1600만번밖에 안되므로, 문제에 주어진 조건대로 돌리면 되는 문제이다.

+ Recent posts