#include <bits/stdc++.h> #define mp make_pair #define fi first #define se second #define pb push_back #define all(x) (x).begin(),(x).end() using namespace std; typedef long long LL; typedef pair<int,int> PII; typedef vector < int > VI; typedef double D; const int MN = 100005, inf = 1000000005, mod = 1000000007; const LL INF = 1000000000000000005LL; int main() { int n, ans = 2; scanf("%d", &n); for(int i = 1; i <= n; ++i) { int c; scanf("%d", &c); if(c == 1) --ans; } ans = max(ans, 0); printf("%d\n", ans); printf("2\n1 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 | #include <bits/stdc++.h> #define mp make_pair #define fi first #define se second #define pb push_back #define all(x) (x).begin(),(x).end() using namespace std; typedef long long LL; typedef pair<int,int> PII; typedef vector < int > VI; typedef double D; const int MN = 100005, inf = 1000000005, mod = 1000000007; const LL INF = 1000000000000000005LL; int main() { int n, ans = 2; scanf("%d", &n); for(int i = 1; i <= n; ++i) { int c; scanf("%d", &c); if(c == 1) --ans; } ans = max(ans, 0); printf("%d\n", ans); printf("2\n1 2"); } |