Submission #1285288

#TimeUsernameProblemLanguageResultExecution timeMemory
1285288goulthenHack (APIO25_hack)C++20
0 / 100
39 ms1472 KiB
#include "hack.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i,a,b) for(int i = a; i <= b; i++) #define pb push_back int hack(){ vector<ll> vals; ll B = 31622, b = 31622; ll N = 1000000000; ll l = 1,r,x; while (1) { vals.clear(); for(ll i = 1; i<=b; i++) { vals.pb(i); } for(ll i = N+1; i<=N+b*b+1; i+=b) { vals.pb(i); } x = collisions(vals); if(x>=B) { l=1; break; } int L=b*b/(x+1),R=b*b/(x); if(x==1) R = N; //cout << L << ' ' << R << ' ' << x << ' ' << l << '\n'; l += L; b = sqrt(b*b/2); if(R-L+1 <= 2*B) break; } //cout << "FOUND RANGE: " << l << ' ' << l+B << '\n'; for(ll i = l ; i <= l+2*B; i++) { if(i==0)continue; x = collisions({2*i,i}); if(x==1) { return i; } } for(ll i = B; i<= N; i+=B) { x = collisions({2*i,i}); if(x==1) { return i; } } return -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...