結果

問題 No.1673 Lamps on a line
ユーザー ThetaTheta
提出日時 2022-11-01 19:20:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 340 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 10,676 KB
実行使用メモリ 163,020 KB
最終ジャッジ日時 2023-09-23 09:48:49
合計ジャッジ時間 5,787 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
12,324 KB
testcase_01 AC 15 ms
7,904 KB
testcase_02 AC 307 ms
7,764 KB
testcase_03 AC 296 ms
7,864 KB
testcase_04 AC 510 ms
7,908 KB
testcase_05 AC 40 ms
7,852 KB
testcase_06 AC 438 ms
7,956 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N, Q = map(int, input().split())
    condition = 0
    power_of_two = [2**idx for idx in range(N+1)]
    for _ in range(Q):
        L, R = map(int, input().split())
        condition = condition ^ (power_of_two[R] - power_of_two[L-1])
        print(format(condition, "b").count("1"))


if __name__ == "__main__":
    main()
0