Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int N = 1e5+13;
- int a[N];
- bool used[N];
- int main()
- {
- int n;
- cin >> n;
- int cnt = 0;int boofer = -1;
- for (int i = 0; i < n; ++i)
- {
- scanf("%d", &a[i]);
- if (a[i] == 0)
- {
- cnt++
- used[i] = true;
- }
- else
- {
- continue;
- }
- if (cnt == 1)
- {
- boofer = i;
- }
- if (cnt == 2)
- {
- cout << 1 << ' ' << boofer << ' ' << i << endl;
- cnt = 0;
- }
- }
- if (cnt == 1)
- {
- cout << 2 << ' ' << boofer << endl;
- cnt = 0;
- }
- for(int i = 0; i < n; ++i)
- {
- if (!used[i])
- cnt++;
- if (cnt == 1)
- {
- boofer = i;
- }
- if (cnt == 2)
- {
- cnt = 0;
- cout << 1 << ' ' << boofer << ' ' << i << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement