結果

問題 No.1673 Lamps on a line
ユーザー nohakai3nohakai3
提出日時 2022-06-28 21:37:27
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 308 bytes
コンパイル時間 469 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 24,192 KB
最終ジャッジ日時 2024-11-21 16:03:50
合計ジャッジ時間 20,829 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 TLE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for x in anss:
    print(x)
0