| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1305753 | hackstar | Hack (APIO25_hack) | C++20 | 0 ms | 0 KiB |
#include "hack.h"
#include <bits/stdc++.h>
using namespace std;
int hack(){
int low = 1;
int high = 1e9;
map<vector<ll>,int>cache;
while(low<high){
int mid = (low+high)/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);
int curr;
if(cache.count(query))
curr=cache[query];
else
{
curr=collisions(query);
cache[query]=curr;
}
if(curr){
high = mid;
}
else{
low = mid+1;
}
}
return low;
}
