結果

問題 No.1589 Bit Vector
ユーザー rtyu
提出日時 2021-07-12 11:33:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 1,261 bytes
コンパイル時間 707 ms
コンパイル使用メモリ 76,648 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 03:23:45
合計ジャッジ時間 3,110 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

struct opr
{
    string op;
    int a, b, c;
    opr(string op, int a, int b, int c) : op(op), a(a), b(b), c(c) {};
    opr() : op(""), a(0), b(0), c(0) {};
};

vector<opr> ans;
int c[59];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k; cin >> n >> k;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n - i - 1; j++) {
            ans.push_back(opr("UPD", n, 0, 0));
            ans.push_back(opr("XOR", n, n, j));
            ans.push_back(opr("AND", j, j, j + 1));
            ans.push_back(opr("XOR", j + 1, j + 1, n));
            ans.push_back(opr("XOR", j + 1, j, j + 1));
        }
    ans.push_back(opr("UPD", n, 1, 0));
    for (int i = n - k; i < n; i++)
        ans.push_back(opr("AND", n, i, n));
    int tc; cin >> tc;
    for (int ti = 0; ti < tc; ti++) 
        for (int i = 0; i < n; i++) 
            cin >> c[i];
    cout << ans.size() << '\n';
    for (int i = 0; i < ans.size(); i++) {
        if (ans[i].op == "UPD") cout << ans[i].op << " " << ans[i].a << " " << ans[i].b << '\n';
        else cout << ans[i].op << " " << ans[i].a << " " << ans[i].b << " " << ans[i].c << '\n';
    }
    return 0;
}
0