#include #include #include using namespace std; using i64 = long long; using u32 = unsigned int; constexpr int N = int(powl(10, 7)) + 1; u32 x, y, z, w; u32 generate() { u32 t = (x^(x<<11)); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); return w; } int f(i64 a, u32 seed) { ::x = seed; ::y = 1; ::z = 2; ::w = 3; int cnt = 0; for(int i=0; i 1) { i64 md = (lo + hi) / 2; if(f(md, seed) >= (N+1) / 2) { hi = md; } else { lo = md; } } printf("%lld\n", hi); return 0; }