#include #include using namespace std; #define EVIL 16 bool evil[1<>= EVIL; } return is; } #define MAX 10001 long long a[MAX]; unordered_set seen; int main() { evil[0] = true; for (int n=1; n0; k--) { s += a[k]; if (!isEvil(s)) { ok = false; break; } } if (ok) { cout << n << ' ' << a[n] << endl; seen.insert(a[n]); t += a[n]; break; } } } } theEnd: return 0; }