結果

問題 No.1673 Lamps on a line
ユーザー kohei2019kohei2019
提出日時 2022-06-27 23:56:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 338 ms / 2,000 ms
コード長 276 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,348 KB
実行使用メモリ 80,284 KB
最終ジャッジ日時 2024-04-30 13:00:25
合計ジャッジ時間 3,953 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,228 KB
testcase_01 AC 37 ms
52,080 KB
testcase_02 AC 217 ms
77,072 KB
testcase_03 AC 242 ms
77,976 KB
testcase_04 AC 338 ms
78,412 KB
testcase_05 AC 125 ms
77,532 KB
testcase_06 AC 284 ms
77,516 KB
testcase_07 AC 218 ms
79,272 KB
testcase_08 AC 62 ms
67,312 KB
testcase_09 AC 262 ms
76,916 KB
testcase_10 AC 275 ms
77,828 KB
testcase_11 AC 86 ms
76,244 KB
testcase_12 AC 284 ms
80,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q = map(int,input().split())
ls = [0]*N
cnt = 0
for i in range(Q):
    L,R = map(int,input().split())
    L -= 1
    bf = 0
    for j in range(L,R):
        bf += ls[j]
    af = 0
    for j in range(L,R):
        ls[j]^=1
        af += ls[j]
    cnt += af-bf
    print(cnt)
0