답안 #956227

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
956227 2024-04-01T11:01:44 Z thinknoexit Gap (APIO16_gap) C++17
30 / 100
51 ms 7552 KB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = 1e18;
mt19937 rnd(time(NULL));
ll a[100100];
ll Ran(ll l, ll r) {
	return l + (rnd() % (r - l));
}
int n;
ll mx = 1;
void play(ll l, ll r) {
	if (r - l <= mx) return;
	ll mid = Ran(l + 1, r - 1);
	ll ql = -1, qr = -1, _l = -1, _r = -1;
	if (l + 1 <= mid) MinMax(l + 1, mid, &_l, &ql);
	if (mid + 1 <= r - 1) MinMax(mid + 1, r - 1, &qr, &_r);
	if (ql == -1) ql = l;
	if (qr == -1) qr = r;
	mx = max(mx, qr - ql);
	if (_l != -1) play(_l, ql);
	if (_r != -1) play(qr, _r);
}
ll findGap(int T, int N) {
	n = N;
	if (T == 1) {
		a[0] = -1, a[n + 1] = inf + 1;
		for (int i = 1;i <= n / 2;i++) {
			MinMax(a[i - 1] + 1, a[n - i + 2] - 1, &a[i], &a[n - i + 1]);
		}
		if (n & 1) {
			ll _;
			MinMax(a[n / 2] + 1, a[n / 2 + 2] - 1, &a[n / 2 + 1], &_);
		}
		for (int i = 1;i < n;i++) {
			mx = max(mx, a[i + 1] - a[i]);
		}
		return mx;
	}
	ll l, r;
	MinMax(0, inf, &l, &r);
	play(l, r);
	return mx;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 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 2644 KB Output is correct
12 Correct 2 ms 2392 KB Output is correct
13 Correct 1 ms 2476 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 1 ms 2392 KB Output is correct
16 Correct 9 ms 2580 KB Output is correct
17 Correct 8 ms 2724 KB Output is correct
18 Correct 9 ms 2592 KB Output is correct
19 Correct 8 ms 2736 KB Output is correct
20 Correct 6 ms 2560 KB Output is correct
21 Correct 31 ms 3052 KB Output is correct
22 Correct 33 ms 3084 KB Output is correct
23 Correct 29 ms 3108 KB Output is correct
24 Correct 29 ms 3040 KB Output is correct
25 Correct 25 ms 3024 KB Output is correct
26 Correct 28 ms 2880 KB Output is correct
27 Correct 31 ms 3112 KB Output is correct
28 Correct 29 ms 2880 KB Output is correct
29 Correct 29 ms 3036 KB Output is correct
30 Correct 26 ms 3028 KB Output is correct
31 Correct 1 ms 2392 KB Output is correct
32 Correct 1 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Partially correct 1 ms 2392 KB Partially correct
3 Incorrect 1 ms 2392 KB Output isn't correct
4 Incorrect 1 ms 2392 KB Output isn't correct
5 Partially correct 1 ms 2436 KB Partially correct
6 Partially correct 1 ms 2392 KB Partially correct
7 Partially correct 1 ms 2392 KB Partially correct
8 Partially correct 1 ms 2392 KB Partially correct
9 Partially correct 1 ms 2392 KB Partially correct
10 Correct 1 ms 2392 KB Output is 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 2392 KB Output isn't correct
14 Incorrect 1 ms 2392 KB Output isn't correct
15 Partially correct 2 ms 2392 KB Partially correct
16 Incorrect 13 ms 3608 KB Output isn't correct
17 Incorrect 12 ms 3608 KB Output isn't correct
18 Incorrect 13 ms 3620 KB Output isn't correct
19 Incorrect 12 ms 3652 KB Output isn't correct
20 Correct 2 ms 2584 KB Output is correct
21 Incorrect 50 ms 7488 KB Expected int32, but "2499769280" found
22 Incorrect 48 ms 7416 KB Expected int32, but "2499806507" found
23 Incorrect 46 ms 7408 KB Expected int32, but "2499990432" found
24 Incorrect 51 ms 7380 KB Expected int32, but "2499966462" found
25 Partially correct 37 ms 2864 KB Partially correct
26 Incorrect 49 ms 7532 KB Expected int32, but "2499849010" found
27 Incorrect 46 ms 7552 KB Expected int32, but "2499952868" found
28 Incorrect 47 ms 7480 KB Expected int32, but "2499956059" found
29 Incorrect 47 ms 7540 KB Expected int32, but "2500061958" found
30 Correct 8 ms 2892 KB Output is correct
31 Incorrect 1 ms 2404 KB Output isn't correct
32 Correct 1 ms 2404 KB Output is correct