Submission #1246076

#TimeUsernameProblemLanguageResultExecution timeMemory
1246076KALARRYHack (APIO25_hack)C++20
0 / 100
3097 ms64140 KiB
//chockolateman #include<bits/stdc++.h> #include <vector> #include "hack.h" using namespace std; map<long long,bool> done; map<long long,long long> memo; 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(){ done.clear(); memo.clear(); std::vector<long long> temp; bool broke = false; int counter = -1; if(nums.empty()) for(int i = 1 ; i <= 500000 ; 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...