제출 #1205039

#제출 시각아이디문제언어결과실행 시간메모리
1205039irmuunHack (APIO25_hack)C++20
62.90 / 100
112 ms2032 KiB
#include "hack.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

const ll N=1e9,inf=(ll)1e18;

// collisions

int hack(){
	ll lo=2,hi=N;
	while(lo<hi){
		ll mid=(lo+hi)/2;
		ll dif=(mid-lo);
		ll s=sqrtl(dif);
		vector<ll>v;
		v.pb(1);
		for(ll i=1;i<s;i++){
			v.pb(v.back()+s);
		}
		v.pb(v.back()+lo);
		for(ll i=0;i<s;i++){
			v.pb(v.back()+1);
		}
		for(ll i=0;i<dif-s*s;i++){
			v.pb(v.back()+1);
		}
		if(collisions(v)>0){
			hi=mid;
		}
		else{
			lo=mid+1;
		}
	}
	return lo;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...