結果

問題 No.1589 Bit Vector
ユーザー pockynypockyny
提出日時 2021-07-10 03:08:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,034 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 81,756 KB
実行使用メモリ 4,420 KB
最終ジャッジ日時 2023-09-14 15:15:45
合計ジャッジ時間 8,237 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
4,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
4,380 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 18 ms
4,380 KB
testcase_26 AC 17 ms
4,376 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 17 ms
4,376 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <utility>
using namespace std;
vector<pair<string,vector<int>>> v;
string s1 = "UPD",s2 = "AND",s3 = "XOR";
int a[110];
void UPD(int i,int x){
    a[i] = x;
    vector<int> u(2); u[0] = i,u[1] = x;
    v.push_back({s1,u});
}

void AND(int i,int j,int k){
    a[i] = a[j]&a[k];
    vector<int> u(3); u[0] = i,u[1] = j,u[2] = k;
    v.push_back({s2,u});
}

void XOR(int i,int j,int k){
    a[i] = a[j]^a[k];
    vector<int> u(3); u[0] = i,u[1] = j,u[2] = k;
    v.push_back({s3,u});
}

int main(){
    int i,j,n,k,t; cin >> n >> k;
    for(i=1;i<n;i++){
        for(j=i - 1;j>=0;j--){
            UPD(n,0);
            AND(n,j,j + 1);
            AND(j + 1,j,j + 1);
            XOR(n,j,n);
            XOR(n,j + 1,n);
            UPD(j,0);
            XOR(j,j,n);
        }
    }
    UPD(n,0);
    XOR(n,n,k - 1);
    cout << v.size() << endl;
    for(auto x:v){
        cout << x.first << " ";
        for(int y:x.second) cout << y << " ";
        cout << endl;
    }
}
0