답안 #906935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
906935 2024-01-15T04:53:56 Z ByeWorld Gap (APIO16_gap) C++14
0 / 100
21 ms 3020 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;

vector <pii> vec;
void split(ll x, ll y){
	vec.clear();
	vec.pb(pii(x, (x+x+y)/3));
	vec.pb(pii((x+x+y)/3+1, (x+y+y)/3) );
	vec.pb(pii((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);
	for(auto in : vec) sol(in.fi, in.se);
}

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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Incorrect 1 ms 2392 KB Output isn't correct
4 Incorrect 1 ms 2392 KB Output isn't correct
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Incorrect 1 ms 2552 KB Output isn't correct
7 Incorrect 1 ms 2392 KB Output isn't correct
8 Incorrect 1 ms 2392 KB Output isn't correct
9 Incorrect 1 ms 2392 KB Output isn't correct
10 Incorrect 1 ms 2392 KB Output isn't correct
11 Incorrect 1 ms 2392 KB Output isn't correct
12 Incorrect 1 ms 2388 KB Output isn't correct
13 Incorrect 1 ms 2392 KB Output isn't correct
14 Incorrect 1 ms 2392 KB Output isn't correct
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Incorrect 5 ms 2576 KB Output isn't correct
17 Incorrect 6 ms 2760 KB Output isn't correct
18 Incorrect 4 ms 2580 KB Output isn't correct
19 Incorrect 6 ms 2540 KB Output isn't correct
20 Incorrect 4 ms 2536 KB Output isn't correct
21 Incorrect 18 ms 2940 KB Output isn't correct
22 Incorrect 14 ms 2852 KB Output isn't correct
23 Incorrect 15 ms 2856 KB Output isn't correct
24 Incorrect 15 ms 2856 KB Output isn't correct
25 Incorrect 12 ms 2856 KB Output isn't correct
26 Incorrect 19 ms 2760 KB Output isn't correct
27 Incorrect 15 ms 2848 KB Output isn't correct
28 Incorrect 17 ms 2828 KB Output isn't correct
29 Incorrect 16 ms 2848 KB Output isn't correct
30 Incorrect 13 ms 2844 KB Output isn't correct
31 Incorrect 1 ms 2392 KB Output isn't correct
32 Incorrect 1 ms 2392 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Incorrect 1 ms 2392 KB Output isn't correct
4 Incorrect 1 ms 2392 KB Output isn't correct
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Incorrect 1 ms 2392 KB Output isn't correct
7 Incorrect 1 ms 2392 KB Output isn't correct
8 Incorrect 1 ms 2392 KB Output isn't correct
9 Incorrect 1 ms 2392 KB Output isn't correct
10 Incorrect 1 ms 2392 KB Output isn't correct
11 Incorrect 1 ms 2392 KB Output isn't correct
12 Incorrect 2 ms 2392 KB Output isn't correct
13 Incorrect 1 ms 2392 KB Output isn't correct
14 Incorrect 1 ms 2392 KB Output isn't correct
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Incorrect 5 ms 2576 KB Output isn't correct
17 Incorrect 5 ms 2552 KB Output isn't correct
18 Incorrect 5 ms 2548 KB Output isn't correct
19 Incorrect 6 ms 2840 KB Output isn't correct
20 Incorrect 5 ms 2568 KB Output isn't correct
21 Incorrect 16 ms 2856 KB Output isn't correct
22 Incorrect 17 ms 2840 KB Output isn't correct
23 Incorrect 21 ms 2828 KB Output isn't correct
24 Incorrect 18 ms 3020 KB Output isn't correct
25 Incorrect 14 ms 3012 KB Output isn't correct
26 Incorrect 16 ms 2852 KB Output isn't correct
27 Incorrect 16 ms 2940 KB Output isn't correct
28 Incorrect 16 ms 2856 KB Output isn't correct
29 Incorrect 15 ms 2852 KB Output isn't correct
30 Incorrect 11 ms 2856 KB Output isn't correct
31 Incorrect 1 ms 2392 KB Output isn't correct
32 Incorrect 1 ms 2392 KB Output isn't correct