結果

問題 No.862 XORでX
ユーザー vwxyzvwxyz
提出日時 2024-04-08 03:55:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 629 bytes
コンパイル時間 3,308 ms
コンパイル使用メモリ 81,444 KB
実行使用メモリ 93,028 KB
最終ジャッジ日時 2024-04-08 03:59:56
合計ジャッジ時間 10,272 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
57,300 KB
testcase_01 AC 39 ms
57,300 KB
testcase_02 AC 41 ms
57,300 KB
testcase_03 AC 38 ms
57,300 KB
testcase_04 AC 38 ms
57,300 KB
testcase_05 AC 39 ms
57,300 KB
testcase_06 AC 39 ms
57,300 KB
testcase_07 AC 39 ms
57,300 KB
testcase_08 AC 53 ms
68,812 KB
testcase_09 AC 54 ms
68,812 KB
testcase_10 AC 91 ms
68,812 KB
testcase_11 AC 79 ms
68,812 KB
testcase_12 AC 41 ms
57,300 KB
testcase_13 AC 43 ms
57,300 KB
testcase_14 AC 39 ms
57,300 KB
testcase_15 AC 38 ms
57,300 KB
testcase_16 AC 82 ms
89,188 KB
testcase_17 AC 98 ms
89,188 KB
testcase_18 AC 80 ms
89,188 KB
testcase_19 AC 81 ms
89,188 KB
testcase_20 AC 105 ms
93,024 KB
testcase_21 AC 87 ms
93,024 KB
testcase_22 AC 87 ms
93,028 KB
testcase_23 AC 93 ms
93,024 KB
testcase_24 AC 86 ms
93,004 KB
testcase_25 AC 86 ms
93,028 KB
testcase_26 AC 87 ms
92,976 KB
testcase_27 AC 96 ms
92,976 KB
testcase_28 AC 85 ms
93,024 KB
testcase_29 AC 85 ms
93,028 KB
testcase_30 AC 87 ms
93,024 KB
testcase_31 AC 100 ms
93,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,X=map(int,input().split())
M=10**5
if X>=2:
    if N%4==0:
        ans_lst=[X,1]
    elif N%4==1:
        ans_lst=[X]
    elif N%4==2:
        ans_lst=[X^1,1]
    else:
        ans_lst=[X^1]
        
else:
    if N%4==0:
        ans_lst=[1,2,4,6]
    elif N%4==1:
        ans_lst=[1]
    elif N%4==2:
        ans_lst=[2,3]
    else:
        ans_lst=[3,4,6]
for m in range(4,M+3,2):
    if len(ans_lst)<N and not m in ans_lst[:5] and not m+1 in ans_lst[:10]:
        ans_lst.append(m)
        ans_lst.append(m+1)
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