#include <bits/stdc++.h> using namespace std; template <typename T> T load() { T r; cin >> r; return r; } template <typename T> vector<T> loadMany(int n) { vector<T> rs(n); generate(rs.begin(), rs.end(), &load<T>); return rs; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); auto n = load<int>(); auto ones = 0; for (auto i=0; i<n; ++i) if (load<int>() == 1) ++ones; cout << max(2 - ones, 0) << "\n2\n1 2\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <bits/stdc++.h> using namespace std; template <typename T> T load() { T r; cin >> r; return r; } template <typename T> vector<T> loadMany(int n) { vector<T> rs(n); generate(rs.begin(), rs.end(), &load<T>); return rs; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); auto n = load<int>(); auto ones = 0; for (auto i=0; i<n; ++i) if (load<int>() == 1) ++ones; cout << max(2 - ones, 0) << "\n2\n1 2\n"; } |