#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using ull = unsigned long long; constexpr int TEN(int n) {return (n==0)?1:10*TEN(n-1);} ll nex(ll S) { return (S * 12345) % 1000003; } const int MN = 130; int N; vector g[MN]; int idx[MN]; namespace StopWatch { clock_t st; bool f = false; void start() { f = true; st = clock(); } int msecs() { assert(f); return (clock()-st)*1000 / CLOCKS_PER_SEC; } } uint32_t xor96(void) { static uint32_t x = 123456789; static uint32_t y = 362436069; static uint32_t z = 521288629; uint32_t t; t = (x ^ (x << 3)) ^ (y ^ (y >> 19)) ^ (z ^ (z << 6)); x = y; y = z; return z = t; } void solve() { /* printf("N: %d\n", N); for (int i = 0; i < N; i++) { printf("vec %d:", i); for (int d: g[i]) { printf("%d ", d); } printf("\n"); }*/ int ans = 0; vector ans_p; iota(idx, idx+N, 0); StopWatch::start(); while (StopWatch::msecs() < 7200) { for (int fe = 0; fe < 1000; fe++) { for (int i = 0; i < N; i++) { swap(idx[i], idx[xor96()%(i+1)]); } bool used[N]; fill_n(used, N, false); int co = 0; for (int i = 0; i < N; i++) { int p = idx[i]; if (!used[p]) { co++; for (int d: g[p]) { used[d] = true; } } } if (ans < co) { ans = co; ans_p.clear(); fill_n(used, N, false); for (int i = 0; i < N; i++) { int p = idx[i]; if (!used[p]) { ans_p.push_back(p+1); for (int d: g[p]) { used[d] = true; } } } } } } if (ans == N) { printf("-1\n"); return; } printf("%d\n", ans+1); int m = (int)ans_p.size(); for (int i = 0; i < m; i++) { printf("%d", ans_p[i]); if (i < m-1) { printf(" "); } else { printf("\n"); } } } int main() { ll S; cin >> S; S = nex(S); N = (S % 120) + 2; S = nex(S); ll P = S; for (int i = 0; i < N; i++) { for (int j = i+1; j < N; j++) { S = nex(S); if (S >= P) { g[i].push_back(j); g[j].push_back(i); } } } solve(); return 0; }