結果

問題 No.1673 Lamps on a line
ユーザー fzrmfzrm
提出日時 2021-09-12 21:23:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 409 bytes
コンパイル時間 763 ms
コンパイル使用メモリ 10,724 KB
実行使用メモリ 12,356 KB
最終ジャッジ日時 2023-09-06 22:07:35
合計ジャッジ時間 6,161 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
12,356 KB
testcase_01 AC 14 ms
7,976 KB
testcase_02 AC 343 ms
7,772 KB
testcase_03 AC 336 ms
7,860 KB
testcase_04 AC 590 ms
7,800 KB
testcase_05 AC 42 ms
7,952 KB
testcase_06 AC 502 ms
7,732 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,q = map(int, input().split())

def turnLamps(lamps, st, en):
    tmp_state = lamps
    for i in range(st, en):
        tmp_state[i] = swtichTurn(lamps[i])
    return tmp_state


def swtichTurn(state):
    return 1 if state == 0 else 0


lamps = [0 for i in range(n)]

for i in range(q):
    st, en = map(int, input().split())
    lamps = turnLamps(lamps, st -1, en)
    #print(*lamps)
    print(sum(lamps))
0