結果

問題 No.1589 Bit Vector
ユーザー chineristACchineristAC
提出日時 2021-07-09 02:20:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 912 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 82,068 KB
最終ジャッジ日時 2023-09-14 06:16:55
合計ジャッジ時間 7,033 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
74,420 KB
testcase_01 AC 110 ms
74,548 KB
testcase_02 AC 110 ms
74,816 KB
testcase_03 AC 110 ms
74,756 KB
testcase_04 AC 110 ms
74,760 KB
testcase_05 AC 107 ms
74,592 KB
testcase_06 AC 109 ms
74,264 KB
testcase_07 AC 109 ms
74,376 KB
testcase_08 AC 107 ms
74,868 KB
testcase_09 AC 110 ms
74,264 KB
testcase_10 AC 109 ms
74,756 KB
testcase_11 AC 111 ms
74,372 KB
testcase_12 AC 110 ms
74,416 KB
testcase_13 AC 109 ms
74,768 KB
testcase_14 AC 106 ms
74,368 KB
testcase_15 AC 107 ms
74,532 KB
testcase_16 AC 109 ms
74,260 KB
testcase_17 AC 109 ms
74,460 KB
testcase_18 AC 106 ms
74,600 KB
testcase_19 AC 106 ms
74,472 KB
testcase_20 AC 134 ms
81,928 KB
testcase_21 AC 135 ms
81,644 KB
testcase_22 AC 138 ms
81,864 KB
testcase_23 AC 138 ms
81,880 KB
testcase_24 AC 141 ms
82,064 KB
testcase_25 AC 141 ms
81,660 KB
testcase_26 AC 141 ms
81,868 KB
testcase_27 AC 141 ms
81,824 KB
testcase_28 AC 139 ms
81,588 KB
testcase_29 AC 140 ms
82,068 KB
testcase_30 AC 141 ms
81,784 KB
testcase_31 AC 137 ms
81,972 KB
testcase_32 AC 139 ms
81,684 KB
testcase_33 AC 139 ms
81,880 KB
testcase_34 AC 138 ms
81,516 KB
testcase_35 AC 106 ms
74,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import gcd,log

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

def update_ai_by_aj(i,j):
    res = []
    res.append("UPD {} {}".format(i,1))
    res.append("AND {} {} {}".format(i,i,j))
    return res

def sort(i,j,k):
    assert i < j
    """
    ・ai <- ai(1-aj)+aj = ai^aj^(ai and aj)
    ・aj <- aiaj = (ai and aj)
    """
    res = []
    res += update_ai_by_aj(k,j)
    res.append("AND {} {} {}".format(j,i,j))
    res.append("XOR {} {} {}".format(i,i,k))
    res.append("XOR {} {} {}".format(i,i,j))
    return res


N,K = mi()

res = []

for i in range(N):
    for j in range(N-1,i,-1):
        res += sort(j-1,j,N)
res += update_ai_by_aj(N,K-1)

print(len(res))
print(*res,sep="\n")
0