// Karol Kosinski 2018 #include <cstdio> #define FOR(i,a,b) for(int i=(a);i<(b);++i) using namespace std; int main() { int n, ones = 0; scanf("%d", &n); FOR(i,0,n) { int a; scanf("%d", &a); ones += int(a == 1); if(ones == 2) break; } printf("%d\n2\n1 2\n", 2 - ones); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | // Karol Kosinski 2018 #include <cstdio> #define FOR(i,a,b) for(int i=(a);i<(b);++i) using namespace std; int main() { int n, ones = 0; scanf("%d", &n); FOR(i,0,n) { int a; scanf("%d", &a); ones += int(a == 1); if(ones == 2) break; } printf("%d\n2\n1 2\n", 2 - ones); return 0; } |