結果

問題 No.1589 Bit Vector
コンテスト
ユーザー tamato
提出日時 2021-07-08 23:23:36
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 659 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 160 ms
コンパイル使用メモリ 85,900 KB
実行使用メモリ 77,696 KB
最終ジャッジ日時 2026-03-22 14:46:19
合計ジャッジ時間 3,671 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    def bsort(i):
        ans.append("XOR {0} {1} {2}".format(N, i, i+1))
        ans.append("AND {0} {1} {2}".format(i, i, i+1))
        ans.append("AND {0} {1} {2}".format(i+1, i, i+1))
        ans.append("XOR {0} {1} {2}".format(i+1, i+1, N))

    N, K = map(int, input().split())
    ans = []
    for i in range(N-1, -1, -1):
        for j in range(i):
            bsort(j)
    ans.append("UPD {0} {1}".format(N, 0))
    ans.append("XOR {0} {1} {2}".format(N, N-K, N))
    print(len(ans))
    for S in ans:
        print(S)


if __name__ == '__main__':
    main()
0