#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 = (LIM >> 1) + 1, high = LIM + 1, ans = 1;
while(low <= high){
int mid = (low + high) >> 1;
if(in_range(low, mid)){
high = ans = mid - 1;
}
else{
low = mid + 1;
}
}
for(int i = 2; i * i <= ans; i++){
while(ans % i == 0 && in_range(ans / i, ans / i + 1)){
ans /= i;
}
}
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |