Submission #1285787

#TimeUsernameProblemLanguageResultExecution timeMemory
1285787SmuggingSpunHack (APIO25_hack)C++20
78.10 / 100
140 ms1284 KiB
#include "hack.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; const int LIM = 1e9; bool in_range(int l, int r){ int sqr = sqrt(r - l + 1); vector<ll>p; for(int i = 1; i <= sqr; i++){ p.push_back(i); } for(int i = 0; l + sqr * i <= r; i++){ p.push_back(l + sqr * i); } sort(p.begin(), p.end()); p.resize(unique(p.begin(), p.end()) - p.begin()); if(p.back() != r){ p.push_back(r); } return collisions(p) > 0; } int hack(){ int low = 2, high = LIM, ans = 1; while(low <= high){ int mid = (low + high) >> 1, sqr = sqrt(mid - low + 1); if(!in_range(low, mid)){ low = (ans = mid) + 1; } else{ high = mid - 1; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...