Submission #956506

# Submission time Handle Problem Language Result Execution time Memory
956506 2024-04-02T06:28:39 Z thinknoexit Gap (APIO16_gap) C++17
30 / 100
50 ms 2200 KB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = 1e18;
ll a[100100];
int n;
ll ans = 1;
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++) {
			ans = max(ans, a[i + 1] - a[i]);
		}
		return ans;
	}
	ll mn, mx;
	MinMax(0, inf, &mn, &mx);
	ll now = mn;
	while (now < mx) {
		ll n1, n2;
		for (;;ans *= 2) {
			MinMax(now + 1, now + ans, &n1, &n2);
			if (n1 != -1) break;
		}
		ans = max(ans, n1 - now);
		now = n1;
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 8 ms 864 KB Output is correct
17 Correct 8 ms 652 KB Output is correct
18 Correct 8 ms 640 KB Output is correct
19 Correct 10 ms 600 KB Output is correct
20 Correct 7 ms 812 KB Output is correct
21 Correct 33 ms 1968 KB Output is correct
22 Correct 34 ms 1936 KB Output is correct
23 Correct 32 ms 1928 KB Output is correct
24 Correct 34 ms 1896 KB Output is correct
25 Correct 29 ms 1800 KB Output is correct
26 Correct 33 ms 1984 KB Output is correct
27 Correct 36 ms 1900 KB Output is correct
28 Correct 32 ms 1844 KB Output is correct
29 Correct 31 ms 2200 KB Output is correct
30 Correct 27 ms 1824 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 352 KB Output isn't correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Incorrect 0 ms 340 KB Output isn't correct
4 Incorrect 1 ms 344 KB Output isn't correct
5 Incorrect 0 ms 344 KB Output isn't correct
6 Incorrect 1 ms 340 KB Output isn't correct
7 Incorrect 1 ms 344 KB Output isn't correct
8 Incorrect 0 ms 344 KB Output isn't correct
9 Incorrect 1 ms 344 KB Output isn't correct
10 Incorrect 1 ms 344 KB Output isn't correct
11 Incorrect 1 ms 344 KB Output isn't correct
12 Incorrect 1 ms 344 KB Output isn't correct
13 Incorrect 1 ms 344 KB Output isn't correct
14 Incorrect 1 ms 344 KB Output isn't correct
15 Incorrect 1 ms 344 KB Output isn't correct
16 Incorrect 11 ms 816 KB Output isn't correct
17 Incorrect 11 ms 648 KB Output isn't correct
18 Incorrect 11 ms 812 KB Output isn't correct
19 Incorrect 11 ms 648 KB Output isn't correct
20 Incorrect 9 ms 600 KB Output isn't correct
21 Incorrect 49 ms 1184 KB Output isn't correct
22 Incorrect 47 ms 1216 KB Output isn't correct
23 Incorrect 44 ms 1220 KB Output isn't correct
24 Incorrect 47 ms 1236 KB Output isn't correct
25 Incorrect 41 ms 1224 KB Output isn't correct
26 Incorrect 50 ms 1212 KB Output isn't correct
27 Incorrect 44 ms 1084 KB Output isn't correct
28 Incorrect 45 ms 1224 KB Output isn't correct
29 Incorrect 44 ms 1228 KB Output isn't correct
30 Incorrect 36 ms 1140 KB Output isn't correct
31 Incorrect 0 ms 344 KB Output isn't correct
32 Incorrect 0 ms 344 KB Output isn't correct