#include <iostream>
//#include <algorithm>
//#include <cmath>
//#include <vector>
//#include <cstdlib>
//#include <stdint.h>
#include <stdio.h>
#ifdef _WIN32
inline int getchar_unlocked() {
return getchar();
}
#endif
//typedef int64_t ul;
typedef int ul;
char ch;
//int sign;
inline void readU( ul& x ) {
x = 0;
//while((ch < '0' || ch > '9') && ch != '-' && ch != EOF)
while((ch < '0' || ch > '9') && ch != EOF)
ch = getchar_unlocked();
//if (ch == '-')
// sign = -1, ch = getchar_unlocked();
//else
// sign = 1;
do
x = (x << 3) + (x << 1) + ch - '0';
while((ch = getchar_unlocked()) >= '0' && ch <= '9');
//x *= sign;
}
using namespace std;
int main() {
std::ios_base::sync_with_stdio(0);
int n, ai;
readU(n);
int ones_cnt = 0;
while (n--) {
readU(ai);
if (ai == 1) {
ones_cnt++;
if (ones_cnt >= 2) {
break;
}
}
}
cout << (2 - ones_cnt) << "\n2\n1 2" << endl;
}
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #include <iostream> //#include <algorithm> //#include <cmath> //#include <vector> //#include <cstdlib> //#include <stdint.h> #include <stdio.h> #ifdef _WIN32 inline int getchar_unlocked() { return getchar(); } #endif //typedef int64_t ul; typedef int ul; char ch; //int sign; inline void readU( ul& x ) { x = 0; //while((ch < '0' || ch > '9') && ch != '-' && ch != EOF) while((ch < '0' || ch > '9') && ch != EOF) ch = getchar_unlocked(); //if (ch == '-') // sign = -1, ch = getchar_unlocked(); //else // sign = 1; do x = (x << 3) + (x << 1) + ch - '0'; while((ch = getchar_unlocked()) >= '0' && ch <= '9'); //x *= sign; } using namespace std; int main() { std::ios_base::sync_with_stdio(0); int n, ai; readU(n); int ones_cnt = 0; while (n--) { readU(ai); if (ai == 1) { ones_cnt++; if (ones_cnt >= 2) { break; } } } cout << (2 - ones_cnt) << "\n2\n1 2" << endl; } |
English