結果

問題 No.1673 Lamps on a line
ユーザー nohakai3
提出日時 2022-06-28 21:43:41
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 712 ms / 2,000 ms
コード長 289 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-11-21 16:09:51
合計ジャッジ時間 4,761 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

n,q=map(int,input().split())
p=[0]*n
c=0
anss=[]
for i in range(q):
    l,r=map(int,input().split())
    for j in range(l-1,r):
        if p[j]==0:
            c+=1
            p[j]=1
        elif p[j]==1:
            c-=1
            p[j]=0
    anss.append(c)

for x in anss:
    print(x)
0