#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 6; vector < int > v; int n, a; main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i=1; i<=n; i++){ cin >> a; if(a == 1) v.push_back(i); } if(v.size() >= 2) cout << "0"; else if(v.size() == 1) cout << "1"; else cout << "2"; cout << "\n2\n1 2"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 6; vector < int > v; int n, a; main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i=1; i<=n; i++){ cin >> a; if(a == 1) v.push_back(i); } if(v.size() >= 2) cout << "0"; else if(v.size() == 1) cout << "1"; else cout << "2"; cout << "\n2\n1 2"; } |