結果

問題 No.1895 Mod 2
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-04-09 07:18:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 218 ms / 2,000 ms
コード長 871 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 79,704 KB
最終ジャッジ日時 2023-08-19 11:10:08
合計ジャッジ時間 3,870 ms
ジャッジサーバーID
(参考情報)
judge9 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
71,284 KB
testcase_01 AC 193 ms
78,068 KB
testcase_02 AC 218 ms
79,704 KB
testcase_03 AC 187 ms
78,260 KB
testcase_04 AC 179 ms
77,976 KB
testcase_05 AC 187 ms
78,140 KB
testcase_06 AC 188 ms
78,264 KB
testcase_07 AC 189 ms
77,804 KB
testcase_08 AC 184 ms
78,116 KB
testcase_09 AC 197 ms
77,904 KB
testcase_10 AC 184 ms
78,052 KB
testcase_11 AC 183 ms
77,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    def bd(n,cul,ud):
        def j(x,y,ud):
            if ud == ">=":
                if x >= y:return True
                else:return False
            else:
                if x <= y: return True
                else:return False
        l = 0
        r = 316227710
        while r-l > 1:
            mid = (r+l) //2
            if j(cul(mid),n,ud):
                if ud == ">=":r = mid
                else:l = mid   
            else:
                if ud == ">=":l = mid
                else:r = mid
                    
        if ud == ">=":return r
        else:return l
    ans = 0
    l,r = map(int,input().split())
    ans += bd(r,lambda x:x**2,"<=") - bd(l,lambda x:x**2,">=") + 1
    ans += bd(r,lambda x:2*x**2,"<=") - bd(l,lambda x:2*x**2,">=") + 1
    if ans & 1:
        print(1)
    else:
        print(0)
            
0