#include<bits/stdc++.h> using namespace std; #ifndef d #define d(...) #endif #define st first #define nd second #define pb push_back #define siz(c) (int)(c).size() #define all(c) (c).begin(), (c).end() typedef long long LL; typedef long double LD; constexpr int INF=1e9+7; constexpr LL INFL=1e18; template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) { return os << "(" << P.st << "," << P.nd << ")"; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n,cnt=0; cin>>n; for(int i=0;i<n;i++) { int a; cin>>a; cnt+=(a==1); } cout<<max(0,2-cnt)<<"\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 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include<bits/stdc++.h> using namespace std; #ifndef d #define d(...) #endif #define st first #define nd second #define pb push_back #define siz(c) (int)(c).size() #define all(c) (c).begin(), (c).end() typedef long long LL; typedef long double LD; constexpr int INF=1e9+7; constexpr LL INFL=1e18; template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) { return os << "(" << P.st << "," << P.nd << ")"; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n,cnt=0; cin>>n; for(int i=0;i<n;i++) { int a; cin>>a; cnt+=(a==1); } cout<<max(0,2-cnt)<<"\n"; cout<<"2\n1 2\n"; return 0; } |