#include <iostream> int main() { int num_ones = 0; int n; int c; std::cin >> n; for (int i = 0; i < n; ++i) { if (num_ones == 2) { printf("0\n2\n1 2\n"); return 0; } scanf("%d", &c); if (c == 1) num_ones++; } printf("%d\n2\n1 2\n", 2 - num_ones); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <iostream> int main() { int num_ones = 0; int n; int c; std::cin >> n; for (int i = 0; i < n; ++i) { if (num_ones == 2) { printf("0\n2\n1 2\n"); return 0; } scanf("%d", &c); if (c == 1) num_ones++; } printf("%d\n2\n1 2\n", 2 - num_ones); return 0; } |