Submission #1246199

#TimeUsernameProblemLanguageResultExecution timeMemory
1246199KALARRYHack (APIO25_hack)C++20
Compilation error
0 ms0 KiB
//chockolateman #include<bits/stdc++.h> #include <vector> #include "hack.h" using namespace std; const int S = 31623; vector<int> nums; vector<long long> temp; long long query_pair(int x) { temp.clear(); temp.push_back(1); temp.push_back(1+x); return collisions(temp); } int hack(){ temp.clear(); if(nums.empty()) { nums.push_back(0); //make it 1-indexed for(int i = 1 ; i < S ; i++) nums.push_back(nums.back() + 1); for(int i = 1 ; i <= S ; i++) nums.push_back(nums.back() + S); random_shuffle(nums.begin()+1,nums.end()); } int l = 1; int r = nums.size() - 1; int last_push = 0; while(l < r) { int mid = (l+r+1)/2; temp.push_back(nums[i]); for(int i = last_push ; i > mid ; i--) temp.pop_back(); last_push = mid; long long res = collisions(temp); if(res) r = mid-1; else l = mid; } r++; int n; for(l = r-1 ; l >= 0 ; l--) if(query_pair(abs(nums[r] - nums[l]))) { n = abs(nums[r] - nums[l]); break; } vector<int> temp; for(int x = 1 ; x*x <= n ; x++) if(n%x==0) { temp.clear(); temp.push_back(1); temp.push_back(1 + x); if(query_pair(x)) n = x; } return n; }

Compilation message (stderr)

hack.cpp: In function 'int hack()':
hack.cpp:39:33: error: 'i' was not declared in this scope
   39 |             temp.push_back(nums[i]);
      |                                 ^