#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> PII; const int N = 1e6; int main() { int n,t = 0, a; scanf("%d", &n); for(int i = 0;i < n;++i) { scanf("%d", &a); if(a == 1) { ++t; } } if(t >= 2) printf("0\n2\n1 2\n"); else if(t == 1) { printf("1\n2\n1 2\n"); } else { printf("2\n2\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 35 | #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> PII; const int N = 1e6; int main() { int n,t = 0, a; scanf("%d", &n); for(int i = 0;i < n;++i) { scanf("%d", &a); if(a == 1) { ++t; } } if(t >= 2) printf("0\n2\n1 2\n"); else if(t == 1) { printf("1\n2\n1 2\n"); } else { printf("2\n2\n1 2\n"); } return 0; } |