結果

問題 No.1673 Lamps on a line
ユーザー hir355hir355
提出日時 2021-09-10 21:22:51
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 324 ms / 2,000 ms
コード長 244 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 81,288 KB
最終ジャッジ日時 2023-09-02 15:41:03
合計ジャッジ時間 4,428 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,324 KB
testcase_01 AC 72 ms
71,424 KB
testcase_02 AC 234 ms
78,164 KB
testcase_03 AC 243 ms
78,220 KB
testcase_04 AC 315 ms
78,160 KB
testcase_05 AC 127 ms
78,368 KB
testcase_06 AC 290 ms
77,764 KB
testcase_07 AC 233 ms
80,544 KB
testcase_08 AC 96 ms
78,964 KB
testcase_09 AC 297 ms
78,020 KB
testcase_10 AC 309 ms
79,336 KB
testcase_11 AC 116 ms
79,424 KB
testcase_12 AC 324 ms
81,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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