結果

問題 No.1673 Lamps on a line
ユーザー syunsuke1024syunsuke1024
提出日時 2021-09-19 14:46:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 305 ms / 2,000 ms
コード長 284 bytes
コンパイル時間 356 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 81,272 KB
最終ジャッジ日時 2023-09-14 10:24:10
合計ジャッジ時間 4,467 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,200 KB
testcase_01 AC 74 ms
71,492 KB
testcase_02 AC 212 ms
77,748 KB
testcase_03 AC 213 ms
77,580 KB
testcase_04 AC 284 ms
77,552 KB
testcase_05 AC 111 ms
77,328 KB
testcase_06 AC 253 ms
77,464 KB
testcase_07 AC 225 ms
80,268 KB
testcase_08 AC 96 ms
78,808 KB
testcase_09 AC 287 ms
77,688 KB
testcase_10 AC 297 ms
79,504 KB
testcase_11 AC 116 ms
79,444 KB
testcase_12 AC 305 ms
81,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q = map(int,input().split())

L = [0 for i in range(N+2)]
on = 0
for i in range(Q):
    l,r = map(int,input().split())
    for j in range(l,r+1):
        if L[j] == 1:
            on -= 1
            L[j] = 0
        else:
            on += 1
            L[j] = 1
    
    print(on)
0