Submission #901578

# Submission time Handle Problem Language Result Execution time Memory
901578 2024-01-09T15:36:32 Z ByeWorld Gap (APIO16_gap) C++14
0 / 100
49 ms 7524 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;

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 > mx || mn==-1 || mx==-1) return; // gk ada lagi di range ini
	if(s.find(mn)!=s.end() && s.find(mx)!=s.end()) return;
	s.insert(mn); s.insert(mx);

	int tmn = mn, tmx = mx;
	tmn++; tmx--;
	sol(tmn, ((tmn+tmx)>>1) ); 
	//cout << ((tmn+tmx)>>1)+1 << ' '<< tmx << " oo\n";
	sol(((tmn+tmx)>>1)+1, 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(), it2 = s.begin(); it2++;
	while(it2 != s.end()){
		ans = max(ans, (*it2)-(*it));
		it++; it2++;
	}
	return ans;
}
	// for(int i=1; i<=(n+1)/2; i++){
	// 	MinMax(x, y, &mn, &mx);
	// 	a[i] = mn; a[n-i+1] = mx;
	// 	//cout << mn << ' '<< mx << " p\n";
	// 	x = mn+1; y = mx-1;
	// }
# Verdict Execution time Memory 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 0 ms 2392 KB Output isn't correct
5 Incorrect 0 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 0 ms 2392 KB Output isn't correct
11 Incorrect 1 ms 2392 KB Output isn't correct
12 Incorrect 1 ms 2392 KB Output isn't correct
13 Incorrect 1 ms 2480 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 3 ms 2588 KB Output isn't correct
17 Incorrect 4 ms 2804 KB Output isn't correct
18 Incorrect 5 ms 2584 KB Output isn't correct
19 Incorrect 3 ms 2584 KB Output isn't correct
20 Incorrect 10 ms 3596 KB Output isn't correct
21 Incorrect 18 ms 2872 KB Output isn't correct
22 Incorrect 12 ms 2848 KB Output isn't correct
23 Incorrect 12 ms 2856 KB Output isn't correct
24 Incorrect 12 ms 2848 KB Output isn't correct
25 Incorrect 9 ms 2848 KB Output isn't correct
26 Incorrect 12 ms 2860 KB Output isn't correct
27 Incorrect 12 ms 2856 KB Output isn't correct
28 Incorrect 12 ms 2848 KB Output isn't correct
29 Incorrect 13 ms 2764 KB Output isn't correct
30 Incorrect 49 ms 7524 KB Output isn't correct
31 Incorrect 1 ms 2588 KB Output isn't correct
32 Incorrect 0 ms 2392 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 0 ms 2392 KB Output isn't correct
3 Incorrect 0 ms 2392 KB Output isn't correct
4 Incorrect 0 ms 2392 KB Output isn't correct
5 Partially correct 1 ms 2392 KB Partially correct
6 Incorrect 0 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 0 ms 2392 KB Output isn't correct
10 Partially correct 0 ms 2392 KB Partially correct
11 Incorrect 1 ms 2392 KB Output isn't correct
12 Incorrect 1 ms 2392 KB Output isn't correct
13 Incorrect 1 ms 2388 KB Output isn't correct
14 Incorrect 1 ms 2392 KB Output isn't correct
15 Incorrect 2 ms 2392 KB Output isn't correct
16 Incorrect 4 ms 2576 KB Output isn't correct
17 Incorrect 4 ms 2584 KB Output isn't correct
18 Incorrect 3 ms 2584 KB Output isn't correct
19 Incorrect 3 ms 2752 KB Output isn't correct
20 Partially correct 11 ms 3596 KB Partially correct
21 Incorrect 12 ms 2848 KB Output isn't correct
22 Incorrect 13 ms 2648 KB Output isn't correct
23 Incorrect 12 ms 2848 KB Output isn't correct
24 Incorrect 12 ms 2852 KB Output isn't correct
25 Incorrect 9 ms 2848 KB Output isn't correct
26 Incorrect 12 ms 3016 KB Output isn't correct
27 Incorrect 12 ms 2856 KB Output isn't correct
28 Incorrect 13 ms 3104 KB Output isn't correct
29 Incorrect 12 ms 2860 KB Output isn't correct
30 Partially correct 46 ms 7360 KB Partially correct
31 Incorrect 1 ms 2392 KB Output isn't correct
32 Incorrect 1 ms 2392 KB Output isn't correct