結果

問題 No.1673 Lamps on a line
ユーザー yudai1102jpyudai1102jp
提出日時 2021-09-10 21:44:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 645 ms / 2,000 ms
コード長 334 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,644 KB
実行使用メモリ 28,624 KB
最終ジャッジ日時 2023-09-02 16:36:56
合計ジャッジ時間 4,354 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,792 KB
testcase_01 AC 16 ms
7,896 KB
testcase_02 AC 216 ms
13,876 KB
testcase_03 AC 209 ms
13,688 KB
testcase_04 AC 370 ms
17,864 KB
testcase_05 AC 35 ms
8,996 KB
testcase_06 AC 323 ms
16,280 KB
testcase_07 AC 329 ms
20,584 KB
testcase_08 AC 22 ms
10,384 KB
testcase_09 AC 473 ms
23,164 KB
testcase_10 AC 486 ms
24,496 KB
testcase_11 AC 59 ms
11,656 KB
testcase_12 AC 645 ms
28,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, Q = map(int, input().split())
LR = [[int(i) for i in input().split()] for j in range(Q)]

state = [False]*N
now = 0

for q in range(Q):
    l, r = LR[q]

    for i in range(l-1, r):
        if state[i]:
            state[i] = False
            now -= 1
        else:
            state[i] = True
            now += 1
    print(now)
0