結果

問題 No.1589 Bit Vector
ユーザー 👑 rin204rin204
提出日時 2022-01-26 18:58:19
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 2,578 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 78,420 KB
最終ジャッジ日時 2023-08-25 01:05:13
合計ジャッジ時間 7,518 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
71,952 KB
testcase_01 AC 83 ms
71,944 KB
testcase_02 AC 85 ms
71,904 KB
testcase_03 AC 84 ms
71,952 KB
testcase_04 AC 82 ms
72,272 KB
testcase_05 AC 82 ms
72,096 KB
testcase_06 AC 84 ms
72,068 KB
testcase_07 AC 82 ms
72,192 KB
testcase_08 AC 83 ms
72,068 KB
testcase_09 AC 82 ms
72,188 KB
testcase_10 AC 83 ms
71,952 KB
testcase_11 AC 83 ms
72,264 KB
testcase_12 AC 82 ms
72,328 KB
testcase_13 AC 84 ms
72,172 KB
testcase_14 AC 84 ms
72,100 KB
testcase_15 AC 84 ms
72,184 KB
testcase_16 AC 83 ms
71,908 KB
testcase_17 AC 82 ms
71,952 KB
testcase_18 AC 84 ms
71,904 KB
testcase_19 AC 83 ms
72,100 KB
testcase_20 AC 107 ms
78,232 KB
testcase_21 AC 105 ms
78,096 KB
testcase_22 AC 107 ms
78,012 KB
testcase_23 AC 106 ms
78,412 KB
testcase_24 AC 102 ms
78,284 KB
testcase_25 AC 106 ms
78,112 KB
testcase_26 AC 109 ms
78,284 KB
testcase_27 AC 104 ms
78,148 KB
testcase_28 AC 106 ms
78,112 KB
testcase_29 AC 104 ms
78,400 KB
testcase_30 AC 104 ms
78,288 KB
testcase_31 AC 106 ms
78,060 KB
testcase_32 AC 113 ms
78,236 KB
testcase_33 AC 107 ms
78,420 KB
testcase_34 AC 103 ms
78,164 KB
testcase_35 AC 83 ms
72,176 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