結果

問題 No.1589 Bit Vector
ユーザー simkarensimkaren
提出日時 2021-07-09 14:55:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 933 bytes
コンパイル時間 2,084 ms
コンパイル使用メモリ 181,424 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-01 14:00:01
合計ジャッジ時間 9,270 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 2 WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

int N, K;

void input_NK(void){
    cin >> N >> K;
}

void sort_xy(int x, int y, ostringstream& oss){
    oss << "UPD " << N << " 0" << endl;
    oss << "XOR " << N << " " << x << " " << N << endl;
    oss << "AND " << x << " " << x << " " << y << endl;
    oss << "XOR " << y << " " << y << " " << N << endl;
    oss << "XOR " << y << " " << x << " " << y << endl;
}

void sort_prefix(ostringstream& oss){
    string ret = "";
    for (int i = 0; i < N; ++i)
        for (int y = N - 1; y > i; --y)
            sort_xy(y - 1, y, oss);
}

string solve(void){
    ostringstream oss;
    sort_prefix(oss);
    oss << "UPD " << N << " 0" << endl;
    for (int i = N - 1; i >= N - K; --i)
        oss << "AND " << N << " " << i << " " << N << endl;
    return oss.str();
}

int main(void){
    input_NK();
    cout << solve();
    return 0;
}
0