// PA2025, @mjm, r0-zb2
#include <cstdio>
#include <vector>
using namespace std;
int nextInt() { int n; scanf("%d", &n); return n; }
struct Cmd {
int type;
int x;
int y;
void show() const {
if (type < 3)
printf("%d %d %d\n", type, x, y);
else
printf("%d %d\n", type, x);
}
};
int main() {
int n = nextInt();
vector<int> mask(n + 1, 0);
int s = nextInt();
int fst = nextInt();
mask[fst] = 1;
for (int i = 1; i < s; ++i) {
int val = nextInt();
mask[val] = 1;
}
vector<Cmd> res;
int last = n;
for (int i = fst; i <= n; ++i) {
if (mask[i] > 0) {
res.push_back({ 1, last, i });
++last;
} else {
res.push_back({ 3, i, -1 });
res.push_back({ 2, last, last + 1 });
last += 2;
}
}
int sz = res.size();
printf("%d\n", sz);
for (int i = 0; i < sz; ++i)
res[i].show();
return 0;
}
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 49 50 51 | // PA2025, @mjm, r0-zb2 #include <cstdio> #include <vector> using namespace std; int nextInt() { int n; scanf("%d", &n); return n; } struct Cmd { int type; int x; int y; void show() const { if (type < 3) printf("%d %d %d\n", type, x, y); else printf("%d %d\n", type, x); } }; int main() { int n = nextInt(); vector<int> mask(n + 1, 0); int s = nextInt(); int fst = nextInt(); mask[fst] = 1; for (int i = 1; i < s; ++i) { int val = nextInt(); mask[val] = 1; } vector<Cmd> res; int last = n; for (int i = fst; i <= n; ++i) { if (mask[i] > 0) { res.push_back({ 1, last, i }); ++last; } else { res.push_back({ 3, i, -1 }); res.push_back({ 2, last, last + 1 }); last += 2; } } int sz = res.size(); printf("%d\n", sz); for (int i = 0; i < sz; ++i) res[i].show(); return 0; } |
English