본문 바로가기
python-algorithm

백준 21918 전구

by 무적김두칠 2021. 11. 30.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
n,m=map(int,input().split())
bulbs=list(map(int, input().split()))
for i in range(m):
    a,b,c=map(int, input().split())
    if a==1: bulbs[b-1]=c
    elif a==2 :
        for j in range(b-1,c):
            if bulbs[j]==1:bulbs[j]=0
            else : bulbs[j]=1
    elif a==3:
        for j in range(b-1, c):
            bulbs[j]=0
    elif a==4:
        for j in range(b-1, c):
            bulbs[j]=1
print(*bulbs)
cs
반응형

댓글