#include <iostream> using namespace std; int main() { // your code goes here ios_base::sync_with_stdio(0); int n, cnt=0; cin >> n; for(int i=0; i<n;++i) { int x; cin >> x; if (x==1) cnt++; } int res = 0; if (cnt == 0) res = 2; if (cnt == 1) res = 1; cout << res << "\n"; cout << "2\n1 2\n"; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <iostream> using namespace std; int main() { // your code goes here ios_base::sync_with_stdio(0); int n, cnt=0; cin >> n; for(int i=0; i<n;++i) { int x; cin >> x; if (x==1) cnt++; } int res = 0; if (cnt == 0) res = 2; if (cnt == 1) res = 1; cout << res << "\n"; cout << "2\n1 2\n"; return 0; } |