#include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int cnt = 0, n; cin >> n; while (n--) { int v; cin >> v; cnt += (v == 1); } cout << (2 - min(cnt, 2)) << '\n'; cout << "2\n1 2 \n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int cnt = 0, n; cin >> n; while (n--) { int v; cin >> v; cnt += (v == 1); } cout << (2 - min(cnt, 2)) << '\n'; cout << "2\n1 2 \n"; } |