1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<cstdio>
#include<vector>
#include<tuple>
using namespace std;

vector<int> target;
vector<tuple<int, int, int>> ops;

const int NO_ARG = 0;

const int UNION = 1;
const int INTERSECTION = 2;
const int NEGATION = 3;


int main() {
    int n, target_size, target_el;
    scanf("%d%d", &n, &target_size);
    target.resize(target_size);

    for (int i = 0; i < target_size; i++) {
        scanf("%d", &target_el);
        target[i] = target_el;
    }

    int idx = 0;
    for (int i = 1; i <= n; i++) {
        if (idx == target_size || target[idx] != i) {
            // not in set
            ops.emplace_back(NEGATION, i, NO_ARG);
            ops.emplace_back(INTERSECTION, n + ops.size() - 1, n + ops.size());
        }
        else {
            // in set
            ops.emplace_back(UNION, n + ops.size(), i);
            idx++;
        }
    }

    printf("%lu\n", ops.size());
    for (auto op : ops) {
        if (get<0>(op) == NEGATION) {
            printf("%d %d\n", NEGATION, get<1>(op));
        } else {
            printf("%d %d %d\n", get<0>(op), get<1>(op), get<2>(op));
        }
    }
}