結果

問題 No.1930 XOR of Two Range
ユーザー AEnAEn
提出日時 2022-05-26 16:55:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 317 ms / 2,000 ms
コード長 389 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,872 KB
実行使用メモリ 76,284 KB
最終ジャッジ日時 2023-10-20 19:30:05
合計ジャッジ時間 2,915 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,396 KB
testcase_01 AC 303 ms
76,208 KB
testcase_02 AC 312 ms
76,284 KB
testcase_03 AC 317 ms
76,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for i in range(T):
    L, R = map(int, input().split())
    if R == L:
        print(2*L)
    elif L%2 == R%2:
        a = (R-L+2)//2
        if a%2 == 0:
            print((a%4)//2)
        else:
            print((R+L)^((a%4)//2))
    else:
        a = (R-L+1)//2
        if a%2 == 0:
            print((a%4)//2)
        else:
            print(((a%4)//2)^(L+R)^(L+R-1))
0