結果

問題 No.1895 Mod 2
ユーザー titia
提出日時 2022-04-08 22:24:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-11-28 13:06:58
合計ジャッジ時間 2,010 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

# 実験すると、x*x*2^nのときcost+1
# で、n=0,1のときだけ考えれば十分で、重複しないのね。

T=int(input())
for tests in range(T):
    L,R=map(int,input().split())

    ANS=[]

    for i in range(2):
        MIN=int((L/(1<<i))**(1/2))-1
        MAX=int((R/(1<<i))**(1/2))+1
        MIN=max(1,MIN)

        while MIN*MIN*(1<<i)<L:
            MIN+=1

        while MAX*MAX*(1<<i)>R:
            MAX-=1

        if MIN<=MAX:
            ANS.append(MAX-MIN+1)

    print(sum(ANS)%2)
0