結果

問題 No.1589 Bit Vector
ユーザー rin204rin204
提出日時 2022-01-26 18:58:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 74,712 KB
最終ジャッジ日時 2024-06-06 02:03:54
合計ジャッジ時間 4,646 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,044 KB
testcase_01 AC 40 ms
53,788 KB
testcase_02 AC 40 ms
54,584 KB
testcase_03 AC 41 ms
54,252 KB
testcase_04 AC 41 ms
54,164 KB
testcase_05 AC 41 ms
54,596 KB
testcase_06 AC 40 ms
54,164 KB
testcase_07 AC 41 ms
55,172 KB
testcase_08 AC 41 ms
54,572 KB
testcase_09 AC 41 ms
54,484 KB
testcase_10 AC 40 ms
55,876 KB
testcase_11 AC 40 ms
54,692 KB
testcase_12 AC 40 ms
54,004 KB
testcase_13 AC 40 ms
55,260 KB
testcase_14 AC 42 ms
55,236 KB
testcase_15 AC 41 ms
55,184 KB
testcase_16 AC 40 ms
54,352 KB
testcase_17 AC 41 ms
55,156 KB
testcase_18 AC 40 ms
55,328 KB
testcase_19 AC 41 ms
54,964 KB
testcase_20 AC 63 ms
74,548 KB
testcase_21 AC 63 ms
74,256 KB
testcase_22 AC 63 ms
74,408 KB
testcase_23 AC 62 ms
74,140 KB
testcase_24 AC 64 ms
74,124 KB
testcase_25 AC 63 ms
74,216 KB
testcase_26 AC 64 ms
74,536 KB
testcase_27 AC 63 ms
74,508 KB
testcase_28 AC 64 ms
74,184 KB
testcase_29 AC 65 ms
74,256 KB
testcase_30 AC 63 ms
74,456 KB
testcase_31 AC 63 ms
74,452 KB
testcase_32 AC 64 ms
74,312 KB
testcase_33 AC 62 ms
74,712 KB
testcase_34 AC 63 ms
74,388 KB
testcase_35 AC 40 ms
54,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import random

n, K = map(int, input().split())

ans = []

#A = [random.randrange(2) for _ in range(n + 1)]
#an = int(sum(A) >= K)


def UPD(i, x):
    ans.append(f"UPD {i} {x}")
    #A[i] = x

def AND(i, j, k):
    ans.append(f"AND {i} {j} {k}")
    #A[i] = A[j] & A[k]
    
def XOR(i, j, k):
    ans.append(f"XOR {i} {j} {k}")
    #A[i] = A[j] ^ A[k]

# sort 1111....0000
for i in range(n):
    for j in range(n - 1, 0, -1):
        XOR(n, j, j - 1)
        AND(j, j, j - 1)
        XOR(j - 1, j, n)
        
UPD(n, 0)
XOR(n, n, K - 1)
    
print(len(ans))
print(*ans, sep="\n")


#assert A[n] == an
0