#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2") #include #include "atcoder/modint.hpp" using mint = atcoder::static_modint<1000003>; using namespace std; int main() { auto start = chrono::high_resolution_clock::now(); ios::sync_with_stdio(false); cin.tie(nullptr); int _S; cin >> _S; mint S = _S; S *= 12345; int N = S.val() % 120 + 2; S *= 12345; uint P = S.val(); bool adj[N][N]; for (int i = 0; i < N; i++) { adj[i][i] = false; } for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { S *= 12345; adj[i][j] = adj[j][i] = (S.val() >= P); } } vector ans; auto rng = mt19937_64(random_device{}()); vector p(N); for (int i = 0; i < N; i++) { p[i] = i; } while (true) { auto now = chrono::high_resolution_clock::now(); auto ms = chrono::duration_cast(now - start).count(); if (ms > 7950) break; shuffle(p.begin(), p.end(), rng); vector is; for (auto&& x : p) { bool ok = true; for (auto&& y : is) { ok &= !adj[x][y]; } if (ok) is.push_back(x); } if (ans.size() < is.size()) ans.swap(is); } if ((int)ans.size() == N) { cout << -1 << endl; return 0; } cout << ans.size() + 1 << endl; for (int i = 0; i < (int)ans.size(); i++) { cout << ans[i] + 1 << (i + 1 == (int)ans.size() ? "\n" : " "); } }