Submission #1246082

#TimeUsernameProblemLanguageResultExecution timeMemory
1246082KALARRYHack (APIO25_hack)C++20
25 / 100
473 ms11348 KiB
//chockolateman #include<bits/stdc++.h> #include <vector> #include "hack.h" using namespace std; bool done[1000005]; long long memo[1000005]; vector<int> nums; long long query(long long x) { if(done[x]) return memo[x]; done[x] = true; vector<long long> temp; temp.push_back(1); temp.push_back(1+x); memo[x] = collisions(temp); return memo[x]; } int hack(){ memset(done,false,sizeof(done)); memset(memo,0ll,sizeof(memo)); std::vector<long long> temp; bool broke = false; int counter = -1; if(nums.empty()) for(int i = 500001 ; i <= 1000000 ; i++) nums.push_back(i); random_shuffle(nums.begin(),nums.end()); while(!broke) { temp.clear(); counter++; temp.push_back(1); temp.push_back(1 + nums[counter]); if(query(nums[counter])) broke = true; } int n = nums[counter]; for(int x = 1 ; x <= n ; x++) if(n%x==0) { temp.clear(); temp.push_back(1); temp.push_back(1 + x); if(query(x)) n = x; } return n; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...