Submission #1211069

#TimeUsernameProblemLanguageResultExecution timeMemory
1211069hengliaoHack (APIO25_hack)C++20
78.10 / 100
127 ms1280 KiB
#include "hack.h"
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define pll pair<ll, ll>
#define vll vector<ll>
#define pb push_back

typedef long long ll;

namespace{

    const ll mxN=1e9;

    vll f(ll a, ll b){
        ll len=b-a+1;
        ll B=sqrt(len);
        vll re;
        for(ll i=1;i<=B;i++){
            re.pb(i);
        }
        ll cur=B+a;
        while(true){
            re.pb(cur);
            if(cur-1==b) break;
            cur=min(cur+B, b+1);
        }
        return re;
    }
}


int hack(){
    ll lef=2, rig=mxN;

    while(lef<rig){
        ll mid=(lef+rig)/2;
        if(collisions(f(lef, mid))>0){
            rig=mid;
        }
        else{
            lef=mid+1;
        }
    }

    return (int) lef;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...