結果

問題 No.1930 XOR of Two Range
ユーザー tamatotamato
提出日時 2022-05-06 21:53:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 776 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 78,928 KB
最終ジャッジ日時 2023-09-20 02:45:28
合計ジャッジ時間 1,635 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,484 KB
testcase_01 AC 174 ms
78,840 KB
testcase_02 AC 186 ms
78,556 KB
testcase_03 AC 191 ms
78,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline

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

        X = 2 * L
        Y = L + R
        if (Y - X + 1) % 4 == 0:
            if (Y - X + 1) % 8 == 0:
                print(0)
            else:
                print(1)
        elif (Y - X + 1) % 4 == 1:
            if (Y - X) % 8 == 0:
                print(L + R)
            else:
                print((L + R) ^ 1)
        elif (Y - X + 1) % 4 == 2:
            if (Y - X - 1) % 8 == 0:
                print(1)
            else:
                print(0)
        else:
            if (Y - X - 2) % 8 == 0:
                print(1)
            else:
                print(0)


if __name__ == '__main__':
    main()
0