Submission #908645

# Submission time Handle Problem Language Result Execution time Memory
908645 2024-01-16T15:51:49 Z ByeWorld Gap (APIO16_gap) C++14
0 / 100
94 ms 8544 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;
typedef pair<ll,ll> pii;
typedef pair<ll,pii> ipii;

ll mn, mx;
int n;
set<ll> s; ll ans = -INF;
ll le, ri, nx;

long long findGap(int T, int N)
{
	n = N;
	MinMax(0, INF, &mn, &mx); le = mn; ri = mx;
	s.insert(mn); s.insert(mx);

	ll len = mx-mn-1, idx = mn;
	for(ll i=1; i<=n-2; i++){ // n+1 segment
		nx = len / (n-2) * i + le;
		if(idx+1 <= nx){
			cout << idx+1 << ' ' << nx << " p\n";
			MinMax(idx+1, nx, &mn, &mx);
			s.insert(mn); s.insert(mx);
		}

		idx = nx;
	}

	nx = ri-1;
	if(idx+1 <= nx){
		cout << idx+1 << ' ' << nx << " p\n";
		MinMax(idx+1, nx, &mn, &mx);
		s.insert(mn); s.insert(mx);
	}
	//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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Expected EOLN
2 Incorrect 1 ms 2392 KB Expected EOLN
3 Incorrect 1 ms 2392 KB Expected EOLN
4 Incorrect 1 ms 2392 KB Expected EOLN
5 Incorrect 1 ms 2392 KB Expected EOLN
6 Incorrect 1 ms 2392 KB Expected EOLN
7 Incorrect 1 ms 2392 KB Expected EOLN
8 Incorrect 1 ms 2392 KB Expected EOLN
9 Incorrect 1 ms 2392 KB Expected EOLN
10 Incorrect 1 ms 2392 KB Expected EOLN
11 Incorrect 2 ms 2392 KB Expected EOLN
12 Incorrect 2 ms 2392 KB Expected EOLN
13 Incorrect 2 ms 2392 KB Expected EOLN
14 Incorrect 1 ms 2392 KB Expected EOLN
15 Incorrect 2 ms 2392 KB Expected EOLN
16 Incorrect 19 ms 3656 KB Expected EOLN
17 Incorrect 24 ms 3624 KB Expected EOLN
18 Incorrect 20 ms 4160 KB Expected EOLN
19 Incorrect 19 ms 4236 KB Expected EOLN
20 Incorrect 11 ms 2680 KB Expected EOLN
21 Incorrect 85 ms 7628 KB Expected EOLN
22 Incorrect 83 ms 7936 KB Expected EOLN
23 Incorrect 81 ms 8240 KB Expected EOLN
24 Incorrect 84 ms 8476 KB Expected EOLN
25 Incorrect 79 ms 7496 KB Expected EOLN
26 Incorrect 87 ms 7336 KB Expected EOLN
27 Incorrect 94 ms 7428 KB Expected EOLN
28 Incorrect 83 ms 7844 KB Expected EOLN
29 Incorrect 85 ms 7188 KB Expected EOLN
30 Incorrect 39 ms 3752 KB Expected EOLN
31 Incorrect 1 ms 2392 KB Expected EOLN
32 Incorrect 1 ms 2392 KB Expected EOLN
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB Expected EOLN
2 Incorrect 1 ms 2392 KB Expected EOLN
3 Incorrect 1 ms 2392 KB Expected EOLN
4 Incorrect 1 ms 2392 KB Expected EOLN
5 Incorrect 1 ms 2392 KB Expected EOLN
6 Incorrect 1 ms 2392 KB Expected EOLN
7 Incorrect 1 ms 2392 KB Expected EOLN
8 Incorrect 1 ms 2392 KB Expected EOLN
9 Incorrect 1 ms 2392 KB Expected EOLN
10 Incorrect 1 ms 2392 KB Expected EOLN
11 Incorrect 2 ms 2392 KB Expected EOLN
12 Incorrect 2 ms 2392 KB Expected EOLN
13 Incorrect 1 ms 2392 KB Expected EOLN
14 Incorrect 2 ms 2392 KB Expected EOLN
15 Incorrect 2 ms 2480 KB Expected EOLN
16 Incorrect 20 ms 4652 KB Expected EOLN
17 Incorrect 20 ms 3740 KB Expected EOLN
18 Incorrect 22 ms 3736 KB Expected EOLN
19 Incorrect 19 ms 4440 KB Expected EOLN
20 Incorrect 10 ms 2812 KB Expected EOLN
21 Incorrect 82 ms 8048 KB Expected EOLN
22 Incorrect 87 ms 7540 KB Expected EOLN
23 Incorrect 83 ms 7884 KB Expected EOLN
24 Incorrect 80 ms 7848 KB Expected EOLN
25 Incorrect 85 ms 8004 KB Expected EOLN
26 Incorrect 82 ms 8544 KB Expected EOLN
27 Incorrect 84 ms 7952 KB Expected EOLN
28 Incorrect 81 ms 7836 KB Expected EOLN
29 Incorrect 80 ms 8484 KB Expected EOLN
30 Incorrect 41 ms 3408 KB Expected EOLN
31 Incorrect 1 ms 2392 KB Expected EOLN
32 Incorrect 1 ms 2388 KB Expected EOLN