#include<bits/stdc++.h> using namespace std; using i64 = long long; using i32 = int; template<typename T> T load() { T x; cin >> x; return x; } template<typename T> vector<T> loadN(int s) { vector<T> vt(s); for(auto& el : vt) el = load<T>(); return vt; } template<typename T> ostream& operator<<(ostream& os, const vector<T>& vt) { for(auto& el : vt) os << el << ' '; return os; } i32 main() { ios::sync_with_stdio(false); auto seq = loadN<i32>(load<i32>()); auto counter = 0; for(auto& el : seq) if(el == 1) ++counter; cout << 2 - min(counter, 2) << '\n'; cout << "2\n1 2\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include<bits/stdc++.h> using namespace std; using i64 = long long; using i32 = int; template<typename T> T load() { T x; cin >> x; return x; } template<typename T> vector<T> loadN(int s) { vector<T> vt(s); for(auto& el : vt) el = load<T>(); return vt; } template<typename T> ostream& operator<<(ostream& os, const vector<T>& vt) { for(auto& el : vt) os << el << ' '; return os; } i32 main() { ios::sync_with_stdio(false); auto seq = loadN<i32>(load<i32>()); auto counter = 0; for(auto& el : seq) if(el == 1) ++counter; cout << 2 - min(counter, 2) << '\n'; cout << "2\n1 2\n"; } |