#include <cstdio> #include <algorithm> int possible_order[1000000]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &possible_order[i]); printf ("%d\n2\n1 2\n", 2 - std::min<int>(std::count(possible_order, possible_order + n, 1), 2)); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <cstdio> #include <algorithm> int possible_order[1000000]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &possible_order[i]); printf ("%d\n2\n1 2\n", 2 - std::min<int>(std::count(possible_order, possible_order + n, 1), 2)); } |