結果

問題 No.1895 Mod 2
ユーザー titiatitia
提出日時 2022-04-08 22:22:57
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 8,888 KB
最終ジャッジ日時 2023-08-19 00:52:48
合計ジャッジ時間 1,960 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,832 KB
testcase_01 AC 75 ms
8,708 KB
testcase_02 AC 75 ms
8,888 KB
testcase_03 AC 67 ms
8,688 KB
testcase_04 AC 74 ms
8,832 KB
testcase_05 AC 81 ms
8,884 KB
testcase_06 AC 80 ms
8,772 KB
testcase_07 AC 81 ms
8,812 KB
testcase_08 AC 78 ms
8,712 KB
testcase_09 AC 78 ms
8,716 KB
testcase_10 AC 74 ms
8,524 KB
testcase_11 AC 81 ms
8,708 KB
権限があれば一括ダウンロードができます

ソースコード

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