結果

問題 No.1673 Lamps on a line
ユーザー GrayCoderGrayCoder
提出日時 2021-09-10 23:19:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 10,544 KB
実行使用メモリ 15,268 KB
最終ジャッジ日時 2023-09-02 21:47:17
合計ジャッジ時間 4,783 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,912 KB
testcase_01 AC 16 ms
7,768 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
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 = 0
        for i in range(len(a)):
            if n & 1 << i:
                ans += 1
        print(ans)


main()
0