#include <iostream>
#include <bitset>
using namespace std;
const int MAX_N = 50000;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
bitset<MAX_N> finalny_zbior;
int n, s;
cin >> n >> s;
int a;
for (int i = 0; i < s; i++)
{
cin >> a;
finalny_zbior.set(a - 1);
}
cout << 2 * n << "\n";
for (int i = 0; i < n; i++)
{
cout << 3 << " " << i + 1 << "\n";
}
int obecny_indeks = 2 * n;
for (int i = 0; i < n; i++)
{
if (finalny_zbior[i] == 1)
{
cout << 1 << " " << obecny_indeks << " " << i + 1 << "\n";
}
else
{
cout << 2 << " " << obecny_indeks << " " << i + 1 + n << "\n";
}
obecny_indeks++;
}
}
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 | #include <iostream> #include <bitset> using namespace std; const int MAX_N = 50000; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); bitset<MAX_N> finalny_zbior; int n, s; cin >> n >> s; int a; for (int i = 0; i < s; i++) { cin >> a; finalny_zbior.set(a - 1); } cout << 2 * n << "\n"; for (int i = 0; i < n; i++) { cout << 3 << " " << i + 1 << "\n"; } int obecny_indeks = 2 * n; for (int i = 0; i < n; i++) { if (finalny_zbior[i] == 1) { cout << 1 << " " << obecny_indeks << " " << i + 1 << "\n"; } else { cout << 2 << " " << obecny_indeks << " " << i + 1 + n << "\n"; } obecny_indeks++; } } |
English