Submission #1212300

#TimeUsernameProblemLanguageResultExecution timeMemory
1212300fadak-14Hack (APIO25_hack)C++20
100 / 100
81 ms964 KiB
#include "hack.h" #include <bits/stdc++.h> #define ll long long #define db double #define ld long double #define endl '\n' #define eb emplace_back #define em emplace #define pb push_back #define pf push_front #define pp pop_back #define fr first #define sc second #define sz size using namespace std; const ll mx = 1e9; signed hack() { ll s = mx / 2 + 1 ,e = mx ; ll v ,x ,md; vector<ll> tp , arr ; while(s <= e) { md = s + e >> 1 ,tp.clear() ; x= (ll)sqrt(md - s + 1) ; for(ll i =1 ; i <= x ; i++) tp.pb(i) ; for(ll i =1 ;s + i * x <= md; i++) tp.pb(s + i * x) ; tp.pb(md + 1) ; if(collisions(tp) > 0) e = md - 1 , v = md ; else s = md + 1 ; } x = v ; for(ll i = 2 ; i * i <= v; i++) { if(x % i) continue ; arr.pb(i) ; while(x % i == 0) x /= i ; } if(x > 1) arr.pb(x) ; for(ll i: arr) { while(v%i == 0 && collisions({1 , v/ i + 1}) > 0) v/=i; } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...