結果

問題 No.1673 Lamps on a line
ユーザー ThetaTheta
提出日時 2022-11-01 19:35:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 692 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,676 KB
実行使用メモリ 25,296 KB
最終ジャッジ日時 2023-09-23 10:05:01
合計ジャッジ時間 5,680 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,604 KB
testcase_01 AC 20 ms
8,600 KB
testcase_02 AC 312 ms
8,576 KB
testcase_03 AC 311 ms
8,712 KB
testcase_04 AC 525 ms
8,712 KB
testcase_05 AC 46 ms
8,520 KB
testcase_06 AC 455 ms
8,664 KB
testcase_07 AC 427 ms
25,296 KB
testcase_08 AC 24 ms
8,880 KB
testcase_09 AC 656 ms
15,696 KB
testcase_10 AC 638 ms
20,532 KB
testcase_11 AC 73 ms
11,884 KB
testcase_12 AC 692 ms
8,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import lru_cache


def main():
    N, Q = map(int, input().split())
    lamps = set()
    for _ in range(Q):
        L, R = map(int, input().split())
        for number in range(L, R+1):
            if number in lamps:
                lamps.discard(number)
            else:
                lamps.add(number)

        print(len(lamps))


if __name__ == "__main__":
    main()
0