#include<bits/stdc++.h> #define luk(n,m) for(int i=n; i<m; ++i) #define maxn 2000010 #define pb(n) push_back(n) #define mp make_pair #define inf 1000000000 #define mod 1000000007 #define ll long long #define ff first.first #define fs first.second using namespace std; int main() { int n,a; int ile=0; scanf("%d", &n); luk(0,n) { scanf("%d", &a); if((ile==1||ile==0)&&a==1) ++ile; } if(ile==2) printf("0\n"); if(ile==1) printf("1\n"); if(ile==0) printf("2\n"); printf("2\n"); printf("1 2"); }
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 35 36 37 38 39 40 | #include<bits/stdc++.h> #define luk(n,m) for(int i=n; i<m; ++i) #define maxn 2000010 #define pb(n) push_back(n) #define mp make_pair #define inf 1000000000 #define mod 1000000007 #define ll long long #define ff first.first #define fs first.second using namespace std; int main() { int n,a; int ile=0; scanf("%d", &n); luk(0,n) { scanf("%d", &a); if((ile==1||ile==0)&&a==1) ++ile; } if(ile==2) printf("0\n"); if(ile==1) printf("1\n"); if(ile==0) printf("2\n"); printf("2\n"); printf("1 2"); } |