답안 #906931

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
906931 2024-01-15T04:52:23 Z ByeWorld Gap (APIO16_gap) C++14
컴파일 오류
0 ms 0 KB
#include "gap.h"
#include <bits/stdc++.h>
#define bupol __builtin_popcount
//#define int long long 
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
using namespace std;
const int MAXN = 1e5+5;
const int MAXK = 205;
const int LOG = 20;
const int MOD = 1e9+7;
const int SQRT = 520;
const ll INF = 1e18+10;
typedef pair<ll,ll> pii;
typedef pair<ll,pii> ipii;

ll mn, mx;
ll x, y;
int n;
set<ll> s; ll ans = -INF;

void split(ll x, ll y){
	sol(x, (x+x+y)/3);
	sol((x+x+y)/3+1, (x+y+y)/3);
	sol((x+y+y)/3+1, y);
}
// sol(tmn, ((tmn+tmx)>>1) ); 
// 	//cout << ((tmn+tmx)>>1)+1 << ' '<< tmx << " oo\n";
// 	sol(((tmn+tmx)>>1)+1, tmx);

void sol(ll l, ll r){ // cari semua di range l-r
	//cout << l << ' '<< r << " p\n";
	if(l > r) return;
	MinMax(l, r, &mn, &mx);
	if(mn == -1) return; // gk ada

	s.insert(mn); s.insert(mx);

	int tmn = mn, tmx = mx;
	tmn++; tmx--;
	split(tmn, tmx);
}

long long findGap(int T, int N)
{
	n = N;
	sol(0, INF);
	//for(auto in : s) cout << in << " xx\n";
	auto it = s.begin(); ll las = -1;
	while(it != s.end()){
		if(las != -1) ans = max(ans, (*it)-las);
		las = (*it); it++;
	}
	//for(auto in : s) cout << in << " in\n";
	return ans;
}

Compilation message

gap.cpp: In function 'void split(long long int, long long int)':
gap.cpp:29:2: error: 'sol' was not declared in this scope
   29 |  sol(x, (x+x+y)/3);
      |  ^~~