結果

問題 No.1930 XOR of Two Range
コンテスト
ユーザー tamato
提出日時 2022-05-06 21:53:30
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 134 ms / 2,000 ms
+ 131µs
コード長 776 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 229 ms
コンパイル使用メモリ 96,232 KB
実行使用メモリ 84,548 KB
最終ジャッジ日時 2026-08-08 17:09:30
合計ジャッジ時間 2,393 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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