結果

問題 No.862 XORでX
ユーザー vwxyz
提出日時 2024-04-08 03:39:43
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,720 KB
最終ジャッジ日時 2024-10-01 04:50:23
合計ジャッジ時間 8,406 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 1 WA * 19 RE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

N,X=map(int,input().split())
M=10**5
if N%4==0:
    ans_lst=[X,1,2,3]
elif N%4==1:
    ans_lst=[X]
elif N%4==2:
    if X>=2:
        ans_lst=[X^1,1]
    else:
        ans_lst=[2,3]
else:
    if X>=2:
        ans_lst=[X^1,2,3]
    else:
        ans_lst=[3,4,6]
for m in range(8,M+6,4):
    if len(ans_lst)<N:
        for dm in range(4):
            ans_lst.append(m+dm)
print(*ans_lst,sep="/n")
assert len(ans_lst)==len(set(ans_lst))==N
xor=0
for a in ans_lst:
    xor^=a
assert xor==X
0