結果

問題 No.1895 Mod 2
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-04-08 23:10:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 484 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 333,484 KB
最終ジャッジ日時 2024-05-06 08:53:59
合計ジャッジ時間 6,565 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

cnt = 1
n = 10 ** 15
memo = set()
while cnt ** 2 <= n:
    val = cnt ** 2
    cnt2 = 1
    if val in memo:
        cnt += 1
        continue
    while cnt2 * val <= n:
        memo.add(cnt2 * val)
        cnt2 *= 2
    cnt += 1
    
memo = list(sorted(memo))
import bisect
for _ in range(int(input())):
    l,r = map(int,input().split())
    a = (bisect.bisect(memo,l-1))
    b = (bisect.bisect(memo,r))
#     print(a,b)
    if (a - b) & 1:
        print(1)
    else:
        print(0)
0