結果

問題 No.1673 Lamps on a line
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-09-10 22:13:36
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 318 ms / 2,000 ms
コード長 252 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 81,084 KB
最終ジャッジ日時 2023-09-02 18:08:33
合計ジャッジ時間 4,067 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,148 KB
testcase_01 AC 73 ms
71,040 KB
testcase_02 AC 259 ms
77,584 KB
testcase_03 AC 223 ms
77,808 KB
testcase_04 AC 304 ms
77,408 KB
testcase_05 AC 116 ms
77,096 KB
testcase_06 AC 265 ms
77,216 KB
testcase_07 AC 234 ms
80,248 KB
testcase_08 AC 97 ms
79,096 KB
testcase_09 AC 296 ms
77,596 KB
testcase_10 AC 307 ms
79,080 KB
testcase_11 AC 121 ms
79,348 KB
testcase_12 AC 318 ms
81,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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