結果

問題 No.1673 Lamps on a line
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-09-10 21:40:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 193 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,784 KB
実行使用メモリ 81,104 KB
最終ジャッジ日時 2023-09-02 16:26:19
合計ジャッジ時間 3,843 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,328 KB
testcase_01 AC 71 ms
71,232 KB
testcase_02 AC 209 ms
77,504 KB
testcase_03 AC 202 ms
77,236 KB
testcase_04 AC 274 ms
77,424 KB
testcase_05 AC 106 ms
77,048 KB
testcase_06 AC 236 ms
77,412 KB
testcase_07 AC 208 ms
80,336 KB
testcase_08 AC 89 ms
79,068 KB
testcase_09 AC 263 ms
77,944 KB
testcase_10 AC 277 ms
79,452 KB
testcase_11 AC 106 ms
78,960 KB
testcase_12 AC 286 ms
81,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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