제출 #44506

#제출 시각아이디문제언어결과실행 시간메모리
44506faustaadpGap (APIO16_gap)C++17
17.68 / 100
106 ms39476 KiB
#include "gap.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll ma,u1,u2,ce,L1,R1,L2,R2;
queue<pair<ll,ll> > q;
long long findGap(int T, int N)
{
	ma=0;
	q.push(mp(0,1e18));
	while(!q.empty())
	{
		u1=q.front().fi;
		u2=q.front().se;
		q.pop();
		ce=(u1+u2)/2;
		MinMax(u1,ce,&L1,&R1);
		MinMax(ce+1,u2,&L2,&R2);
		ma=max(ma,L2-R1);
		if(R1-L1>ma)
			q.push(mp(L1,R1));
		if(R2-L2>ma)
			q.push(mp(L2,R2));
	}
	return ma;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...