//Damian Denc #include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long ile, xd=0, tmp; cin >> ile; for(long long i=0;i<ile;++i) { cin >> tmp; if(tmp==1) ++xd; } if(xd>=2) cout << 0 << "\n" << 2 << "\n" << 1 << " " << 2; else if(xd==1) cout << "1\n2\n1 2"; else if(xd==0) cout << "2\n2\n1 2"; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | //Damian Denc #include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long ile, xd=0, tmp; cin >> ile; for(long long i=0;i<ile;++i) { cin >> tmp; if(tmp==1) ++xd; } if(xd>=2) cout << 0 << "\n" << 2 << "\n" << 1 << " " << 2; else if(xd==1) cout << "1\n2\n1 2"; else if(xd==0) cout << "2\n2\n1 2"; return 0; } |