#include <cstdio> using namespace std; void printSol(int count) { printf("%d\n2\n1 2\n", count); } int main() { int N = 0; int ones = 0; scanf("%d", &N); for (int i = 0; i < N; ++i) { int b; scanf("%d", &b); if (b == 1) { ++ones; if (ones == 2) { printSol(0); return 0; } } } if (ones == 0) { printSol(2); } else { printSol(1); } 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 | #include <cstdio> using namespace std; void printSol(int count) { printf("%d\n2\n1 2\n", count); } int main() { int N = 0; int ones = 0; scanf("%d", &N); for (int i = 0; i < N; ++i) { int b; scanf("%d", &b); if (b == 1) { ++ones; if (ones == 2) { printSol(0); return 0; } } } if (ones == 0) { printSol(2); } else { printSol(1); } return 0; } |