結果

問題 No.1673 Lamps on a line
ユーザー ossa_2019ossa_2019
提出日時 2021-09-11 01:26:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 427 bytes
コンパイル時間 2,181 ms
コンパイル使用メモリ 86,592 KB
実行使用メモリ 109,292 KB
最終ジャッジ日時 2023-09-03 17:31:20
合計ジャッジ時間 5,425 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,340 KB
testcase_01 AC 73 ms
71,340 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin


def main(inp, inps):
    N, Q = map(int, inp().split())
    L, R = list(zip(*map(lambda x: list(map(int, x.split())), inps())))
    now_bit = 0
    result = [0]*Q
    for i, (l, r) in enumerate(zip(L, R)):
        now_bit += int("1"*(r-l+1) + "0"*(l-1))
        result[i] = sum(1 for x in map(int, str(now_bit)) if x%2)
    
    print("\n".join(map(str, result)))


main(stdin.readline, stdin.readlines)
0