結果

問題 No.1930 XOR of Two Range
コンテスト
ユーザー tamato
提出日時 2022-05-06 21:53:30
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 776 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 274 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 81,792 KB
最終ジャッジ日時 2026-03-27 09:13:18
合計ジャッジ時間 1,475 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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