結果

問題 No.1673 Lamps on a line
ユーザー ああいいああいい
提出日時 2021-12-03 23:17:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 367 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,576 KB
実行使用メモリ 26,376 KB
最終ジャッジ日時 2023-09-20 11:15:25
合計ジャッジ時間 2,831 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,788 KB
testcase_01 AC 16 ms
7,852 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 336 ms
20,596 KB
testcase_08 AC 33 ms
14,544 KB
testcase_09 RE -
testcase_10 AC 504 ms
19,056 KB
testcase_11 AC 69 ms
14,588 KB
testcase_12 AC 651 ms
26,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q = list(map(int,input().split()))
L = [0] * (N+1)
R = [0] * (N+1)
for i in range(Q):
    L[i],R[i] = list(map(int,input().split()))
lamp = [0] * (N+1)
count = 0
for i in range(Q):
    for j in range(L[i],R[i] + 1):
        if lamp[j] == 1:
            count -= 1
            lamp[j] = 0
        else:
            count += 1
            lamp[j] = 1
    print(count)
0