답안 #908646

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
908646 2024-01-16T15:52:28 Z ByeWorld Gap (APIO16_gap) C++14
70 / 100
73 ms 7504 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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't 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 2 ms 2392 KB Output isn't correct
12 Incorrect 1 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 14 ms 3612 KB Output isn't correct
17 Incorrect 14 ms 3604 KB Output isn't correct
18 Incorrect 14 ms 3612 KB Output isn't correct
19 Incorrect 15 ms 3608 KB Output isn't correct
20 Incorrect 6 ms 2572 KB Output isn't correct
21 Incorrect 63 ms 6940 KB Output isn't correct
22 Incorrect 73 ms 6916 KB Output isn't correct
23 Incorrect 62 ms 6932 KB Output isn't correct
24 Incorrect 64 ms 6840 KB Output isn't correct
25 Incorrect 65 ms 7504 KB Output isn't correct
26 Incorrect 60 ms 6944 KB Output isn't correct
27 Incorrect 61 ms 6948 KB Output isn't correct
28 Incorrect 62 ms 7008 KB Output isn't correct
29 Incorrect 62 ms 7000 KB Output isn't correct
30 Incorrect 27 ms 3360 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 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2392 KB Output is correct
13 Correct 2 ms 2392 KB Output is correct
14 Correct 2 ms 2392 KB Output is correct
15 Correct 2 ms 2392 KB Output is correct
16 Correct 18 ms 3548 KB Output is correct
17 Correct 15 ms 3604 KB Output is correct
18 Correct 15 ms 3612 KB Output is correct
19 Correct 14 ms 3612 KB Output is correct
20 Correct 6 ms 2392 KB Output is correct
21 Correct 67 ms 7000 KB Output is correct
22 Correct 72 ms 6932 KB Output is correct
23 Correct 61 ms 6932 KB Output is correct
24 Correct 64 ms 7048 KB Output is correct
25 Correct 66 ms 7388 KB Output is correct
26 Correct 63 ms 6864 KB Output is correct
27 Correct 60 ms 6940 KB Output is correct
28 Correct 63 ms 6876 KB Output is correct
29 Correct 64 ms 6928 KB Output is correct
30 Correct 26 ms 3360 KB Output is correct
31 Correct 1 ms 2392 KB Output is correct
32 Correct 1 ms 2392 KB Output is correct