結果

問題 No.1673 Lamps on a line
ユーザー GrayCoderGrayCoder
提出日時 2021-09-10 23:14:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 347 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 10,756 KB
実行使用メモリ 21,604 KB
最終ジャッジ日時 2023-09-02 21:32:13
合計ジャッジ時間 5,178 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,872 KB
testcase_01 AC 16 ms
7,808 KB
testcase_02 AC 162 ms
12,312 KB
testcase_03 AC 149 ms
12,144 KB
testcase_04 AC 265 ms
15,320 KB
testcase_05 AC 32 ms
8,668 KB
testcase_06 AC 260 ms
14,212 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N, Q = map(int, input().split())
    LR = [tuple(map(int, input().split())) for _ in [0] * Q]

    n = 0
    for l, r in LR:
        a = "1" * (r - l + 1) + "0" * (N - r)
        n = n ^ int(a, 2)
        ans = sum(map(int, bin(n)[2:]))
        print(ans)


main()
0