結果

問題 No.1673 Lamps on a line
ユーザー GrayCoderGrayCoder
提出日時 2021-09-10 23:15:35
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 347 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 196,080 KB
最終ジャッジ日時 2023-09-02 21:33:43
合計ジャッジ時間 5,528 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,656 KB
testcase_01 AC 74 ms
71,280 KB
testcase_02 AC 174 ms
83,508 KB
testcase_03 AC 174 ms
83,556 KB
testcase_04 AC 220 ms
88,540 KB
testcase_05 AC 114 ms
78,296 KB
testcase_06 AC 210 ms
86,440 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