結果

問題 No.1589 Bit Vector
ユーザー convexineqconvexineq
提出日時 2021-07-09 07:04:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 653 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 71,468 KB
最終ジャッジ日時 2023-09-14 06:21:19
合計ジャッジ時間 4,533 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,024 KB
testcase_01 AC 65 ms
71,108 KB
testcase_02 AC 68 ms
71,280 KB
testcase_03 AC 64 ms
71,468 KB
testcase_04 AC 70 ms
71,192 KB
testcase_05 AC 68 ms
71,036 KB
testcase_06 AC 66 ms
71,076 KB
testcase_07 AC 67 ms
71,076 KB
testcase_08 AC 65 ms
71,156 KB
testcase_09 AC 66 ms
71,016 KB
testcase_10 AC 64 ms
71,344 KB
testcase_11 AC 66 ms
71,276 KB
testcase_12 AC 66 ms
71,024 KB
testcase_13 AC 62 ms
71,244 KB
testcase_14 AC 64 ms
71,296 KB
testcase_15 AC 62 ms
71,180 KB
testcase_16 AC 63 ms
71,256 KB
testcase_17 AC 64 ms
71,120 KB
testcase_18 AC 64 ms
71,152 KB
testcase_19 AC 63 ms
71,172 KB
testcase_20 AC 67 ms
71,020 KB
testcase_21 AC 69 ms
71,080 KB
testcase_22 AC 68 ms
71,248 KB
testcase_23 AC 67 ms
71,040 KB
testcase_24 AC 66 ms
71,016 KB
testcase_25 AC 66 ms
71,124 KB
testcase_26 AC 68 ms
71,124 KB
testcase_27 AC 66 ms
71,176 KB
testcase_28 AC 66 ms
71,084 KB
testcase_29 AC 63 ms
71,180 KB
testcase_30 AC 66 ms
71,368 KB
testcase_31 AC 66 ms
71,148 KB
testcase_32 AC 66 ms
71,268 KB
testcase_33 AC 66 ms
71,340 KB
testcase_34 AC 71 ms
71,080 KB
testcase_35 AC 65 ms
71,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def UPD(i,x):
    ans.append(f"UPD {i} {x}")

def AND(i,j,k):
    ans.append(f"AND {i} {j} {k}")

def XOR(i,j,k):
    ans.append(f"XOR {i} {j} {k}")

n,k = map(int,input().split())
ans = []

#加算
for i in range(1,n):
    for j in range((i+1).bit_length()):
        AND(n,i,j)
        XOR(j,i,j)
        UPD(i,0)
        XOR(i,i,n)

# kと和 を下の桁からみる。k について 0 -> or, 1 -> and と変換する
if k&1:
    UPD(n,0)
    XOR(n,0,n)
else:
    UPD(n,1)
k //= 2
for i in range(1,n):
    if k&1:
        AND(n,i,n)
    else:
        AND(0,i,n)
        XOR(n,i,n)
        XOR(n,0,n)
    k //= 2

print(len(ans))
print("\n".join(ans))
0