#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); long long n; cin >> n; int x = 2; int tmp; for(int i = 0; i < n; i++) { cin >> tmp; if (tmp == 1 && x > 0) x--; } cout << x << "\n2\n1 2"; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); long long n; cin >> n; int x = 2; int tmp; for(int i = 0; i < n; i++) { cin >> tmp; if (tmp == 1 && x > 0) x--; } cout << x << "\n2\n1 2"; return 0; } |