#include "hack.h"
#include <bits/stdc++.h>
using namespace std;
int squareroot(int n){
int x = sqrt(n);
while(x*x<n){
x++;
}
while(x*x>n){
x--;
}
return x;
}
int hack(){
int low = 1;
int high = 1000000000;
while(low<high){
int mid = (low+high)/2;
int low1 = low;
low = max(low,mid/2);
int s = sqrt(mid-low+1);
vector<long long> query;
for(int i=0;i<s;i++){
query.push_back(i+1);
}
for(int i=0;low+s*(i+1)<=mid;i++){
query.push_back(low+s*(i+1));
}
query.push_back(mid+1);
low = low1;
if(collisions(query)){
high = mid;
}
else{
low = mid+1;
}
}
return low;
}
# | 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... |