#include <cstdio> #include <cassert> #include <set> #include <algorithm> #include <cstring> const int M = 201013; int main() { int n, j = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { int x; scanf("%d", &x); if (x == 1) j++; } printf("%d\n2\n1 2\n", 2 - std::min(j, 2)); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <cstdio> #include <cassert> #include <set> #include <algorithm> #include <cstring> const int M = 201013; int main() { int n, j = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { int x; scanf("%d", &x); if (x == 1) j++; } printf("%d\n2\n1 2\n", 2 - std::min(j, 2)); } |