반응형
def order(a,b,c, bulbs):
    if a ==1:
        bulbs[b-1] = c
    if a ==2:
        temp=bulbs[b-1:c]
        temp_list = [-x+1 for x in temp]
        bulbs[b-1:c] = temp_list
    if a ==3:
        bulbs[b-1:c]= [0 for i in range(b-1,c)]
    if a ==4:
        bulbs[b-1:c]= [1 for i in range(b-1,c)]
        
    return bulbs

n,k = map(int, input().split())

bulbs = list(map(int, input().split()))

for j in range(k):
    a,b,c = map(int,input().split())
    bulbs=order(a,b,c,bulbs)
for bulb in bulbs:
    print(bulb,end=" ")
반응형

+ Recent posts