結果

問題 No.1673 Lamps on a line
ユーザー first_vil
提出日時 2021-09-10 21:24:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 273 ms / 2,000 ms
コード長 193 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 80,188 KB
最終ジャッジ日時 2024-06-11 22:20:38
合計ジャッジ時間 3,331 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

n,q=map(int,input().split())
cnt=0
f=[0]*(n+10)
for _ in range(q):
    l,r=map(int,input().split())
    for i in range(l,r+1):
        cnt-=f[i]
        f[i]^=1
        cnt+=f[i]
    print(cnt)
0