#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <set> #include <unordered_set> #include <queue> using namespace std; typedef long long LL; int main() { int cnt = 0; ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for(int i = 1; i <= n; i ++) { int x; cin >> x; if(x == 1) cnt ++; } cout << max(0, 2 - cnt) << "\n"; cout << 2 << "\n" << 1 << " " << 2; 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 | #include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <set> #include <unordered_set> #include <queue> using namespace std; typedef long long LL; int main() { int cnt = 0; ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for(int i = 1; i <= n; i ++) { int x; cin >> x; if(x == 1) cnt ++; } cout << max(0, 2 - cnt) << "\n"; cout << 2 << "\n" << 1 << " " << 2; return 0; } |