結果

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

ソースコード

diff #

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