#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
const int MX = 50005;
int S[MX];
int main()
{
int n,s;
scanf("%d%d",&n,&s);
int a;
for (int i = 0; i < s; i++)
{
scanf("%d", &a);
S[a]=1;
}
cout << s + 2 *(n - s) + 1 << endl;
cout << "1 1 1" << endl;
int A = n + 1;
for (int i = 1; i <= n; i++)
{
if (S[i])
{
cout << 1 << " " << i << " " << A << endl;
A++;
}
else
{
cout << 3 << " " << i << endl;
cout << 2 << " " << A << " " << A + 1 << endl;
A += 2;
}
}
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 | #include <iostream> #include <cstdio> #include <vector> using namespace std; const int MX = 50005; int S[MX]; int main() { int n,s; scanf("%d%d",&n,&s); int a; for (int i = 0; i < s; i++) { scanf("%d", &a); S[a]=1; } cout << s + 2 *(n - s) + 1 << endl; cout << "1 1 1" << endl; int A = n + 1; for (int i = 1; i <= n; i++) { if (S[i]) { cout << 1 << " " << i << " " << A << endl; A++; } else { cout << 3 << " " << i << endl; cout << 2 << " " << A << " " << A + 1 << endl; A += 2; } } return 0; } |
English