結果

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

ソースコード

diff #

import sys
input = sys.stdin.readline

# 実験すると、x*x*2^nのときcost+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(MAX,MIN,MAX*MAX*(1<<i),MIN*MIN*(1<<i))

    #print(ANS)
    
    print(sum(ANS)%2)
0