結果

問題 No.1673 Lamps on a line
ユーザー TomoyarnTomoyarn
提出日時 2022-02-16 05:26:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 311 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 81,212 KB
最終ジャッジ日時 2023-09-11 17:06:58
合計ジャッジ時間 4,268 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,032 KB
testcase_01 AC 72 ms
71,320 KB
testcase_02 AC 275 ms
77,736 KB
testcase_03 AC 240 ms
77,388 KB
testcase_04 AC 311 ms
77,996 KB
testcase_05 AC 119 ms
77,284 KB
testcase_06 AC 284 ms
77,508 KB
testcase_07 AC 234 ms
79,968 KB
testcase_08 AC 95 ms
78,816 KB
testcase_09 AC 299 ms
77,604 KB
testcase_10 AC 305 ms
79,152 KB
testcase_11 AC 115 ms
79,316 KB
testcase_12 AC 309 ms
81,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yukicoder No.1673 Lamps on a line
N, Q = map(int, input().split())

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