結果

問題 No.1673 Lamps on a line
ユーザー stoqstoq
提出日時 2021-08-02 09:29:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 933 ms / 2,000 ms
コード長 319 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 10,660 KB
実行使用メモリ 12,236 KB
最終ジャッジ日時 2023-09-02 15:02:20
合計ジャッジ時間 6,266 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,800 KB
testcase_01 AC 16 ms
7,780 KB
testcase_02 AC 352 ms
7,840 KB
testcase_03 AC 346 ms
7,784 KB
testcase_04 AC 600 ms
7,920 KB
testcase_05 AC 44 ms
7,852 KB
testcase_06 AC 519 ms
7,864 KB
testcase_07 AC 485 ms
11,272 KB
testcase_08 AC 45 ms
10,356 KB
testcase_09 AC 694 ms
8,828 KB
testcase_10 AC 729 ms
10,060 KB
testcase_11 AC 96 ms
10,360 KB
testcase_12 AC 933 ms
12,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


0