#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
ios_base :: sync_with_stdio(false);
int n; cin >> n;
int ones = 0;
for(int i = 0; i < n; i += 1) {
int dg; cin >> dg;
if(dg == 1)
ones += 1;
}
int cost = max(2 - ones, 0);
cout << cost << "\n";
cout << 2 << "\n";
cout << "1 2\n";
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include <vector> #include <algorithm> #include <iostream> using namespace std; int main() { ios_base :: sync_with_stdio(false); int n; cin >> n; int ones = 0; for(int i = 0; i < n; i += 1) { int dg; cin >> dg; if(dg == 1) ones += 1; } int cost = max(2 - ones, 0); cout << cost << "\n"; cout << 2 << "\n"; cout << "1 2\n"; } |
English