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
#include <cstdio>
#include <vector>
#include <bitset>

using namespace std;

const int MAX_N = 50000;

int main () {
	int n, s, i, m, b;
	scanf("%d %d", &n, &s);
	bitset<MAX_N> B;
	for (i = 0; i < s; ++i) {
		scanf("%d", &b);
		B[b - 1] = true;
	}
	m = 0;
	vector<pair<int, pair<int, int> > > ops;
	for (i = 0; i < n; ++i) {
		if (B[i]) {
			ops.push_back(make_pair(1, make_pair(i + 1, n + m)));
			++m;
		}
		else {
			ops.push_back(make_pair(3, make_pair(i + 1, 0)));
			ops.push_back(make_pair(2, make_pair(n + m, n + m + 1)));
			m += 2;
		}
	}
	printf("%d\n", m);
	for (i = 0; i < m; ++i) {
		printf("%d %d", ops[i].first, ops[i].second.first);
		if (ops[i].first != 3) {
			printf(" %d", ops[i].second.second);
		}
		printf("\n");
	}
	return 0;
}