結果

問題 No.1673 Lamps on a line
ユーザー H3PO4H3PO4
提出日時 2021-09-10 21:24:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 541 ms / 2,000 ms
コード長 278 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 10,628 KB
実行使用メモリ 12,052 KB
最終ジャッジ日時 2023-09-02 15:45:55
合計ジャッジ時間 3,512 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,880 KB
testcase_01 AC 15 ms
7,932 KB
testcase_02 AC 126 ms
8,352 KB
testcase_03 AC 122 ms
8,200 KB
testcase_04 AC 209 ms
8,204 KB
testcase_05 AC 27 ms
8,168 KB
testcase_06 AC 192 ms
8,156 KB
testcase_07 AC 250 ms
11,200 KB
testcase_08 AC 22 ms
10,004 KB
testcase_09 AC 365 ms
8,436 KB
testcase_10 AC 367 ms
9,884 KB
testcase_11 AC 49 ms
10,136 KB
testcase_12 AC 541 ms
12,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.buffer.readline

N, Q = map(int, input().split())
table = [0] * N
ans = 0
for _ in range(Q):
    l, r = map(int, input().split())
    for i in range(l - 1, r):
        ans += (1 - table[i]) - table[i]
        table[i] = 1 - table[i]
    print(ans)
0