#include <iostream> using namespace std; int n, ans; int main() { ios_base::sync_with_stdio(0); cin >> n; for (int i = 0, x; i < n; i++) { cin >> x; ans += x == 1 ? 1 : 0; } cout << (ans > 2 ? 0 : 2 - ans) << "\n2\n1 2"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <iostream> using namespace std; int n, ans; int main() { ios_base::sync_with_stdio(0); cin >> n; for (int i = 0, x; i < n; i++) { cin >> x; ans += x == 1 ? 1 : 0; } cout << (ans > 2 ? 0 : 2 - ans) << "\n2\n1 2"; } |