結果

問題 No.1673 Lamps on a line
ユーザー lllllll88938494
提出日時 2022-01-11 08:54:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 277 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 355 ms
コンパイル使用メモリ 82,072 KB
実行使用メモリ 80,220 KB
最終ジャッジ日時 2024-11-14 11:26:39
合計ジャッジ時間 3,337 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

n,q=map(int,input().split())
ns=[0]*n
cnt=0

for i in range(q):
    l,r=map(int,input().split())
    for i in range(l-1,r):
        ns[i] += 1
        if ns[i] %2 == 0:
            cnt -= 1
        else:
            cnt += 1
    print(cnt)

    
0