Submission #882364

# Submission time Handle Problem Language Result Execution time Memory
882364 2023-12-03T05:29:17 Z dubabuba Gap (APIO16_gap) C++14
0 / 100
17 ms 3108 KB
#include "gap.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
#define ff first
#define ss second

struct node {
	node *LC, *RC;
	ll tl, tr;
	ll mn, mx;
	ll ans;

	node(ll l, ll r) {
		ans = -1;
		tl = l, tr = r;
		MinMax(l, r, &mn, &mx);
	}

	bool birth() {
		if(tl == tr) return 0;
		if(mn == mx) return 0;
		LC = new node(tl, (tl + tr) / 2);
		RC = new node((tl + tr) / 2 + 1, tr);
		return 1;
	}

	ll merge(node *L, node *R) {
		ll ret = max(L-> ans, R-> ans);
		if(L-> mx == -1) return ret;
		if(R-> mx == -1) return ret;
		if(L-> mx == R-> mn) return ret;
		return max(R-> mn - L-> mx, ret);
	}

	void build() {
		if(tl == tr) return;
		if(mn == mx) return;

		LC-> build();
		RC-> build();
		ans = merge(LC, RC);
	}
};

ll findGap(int T, int N) {
	node *root = new node(1LL, N);
	return root-> ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't 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 Incorrect 0 ms 2392 KB Output isn't correct
6 Incorrect 1 ms 2392 KB Output isn't correct
7 Incorrect 0 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 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 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 4 ms 2736 KB Output isn't correct
17 Incorrect 3 ms 2592 KB Output isn't correct
18 Incorrect 3 ms 2588 KB Output isn't correct
19 Incorrect 4 ms 2752 KB Output isn't correct
20 Incorrect 3 ms 2812 KB Output isn't correct
21 Incorrect 13 ms 2832 KB Output isn't correct
22 Incorrect 13 ms 3020 KB Output isn't correct
23 Incorrect 13 ms 2856 KB Output isn't correct
24 Incorrect 14 ms 3020 KB Output isn't correct
25 Incorrect 13 ms 2772 KB Output isn't correct
26 Incorrect 12 ms 3108 KB Output isn't correct
27 Incorrect 13 ms 2868 KB Output isn't correct
28 Incorrect 17 ms 2832 KB Output isn't correct
29 Incorrect 13 ms 3024 KB Output isn't correct
30 Incorrect 7 ms 2852 KB Output isn't correct
31 Incorrect 0 ms 2392 KB Output isn't correct
32 Incorrect 0 ms 2392 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2392 KB Output isn't 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 Incorrect 1 ms 2392 KB Output isn't 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 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 2392 KB Output isn't correct
14 Incorrect 1 ms 2644 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 3 ms 2736 KB Output isn't correct
18 Incorrect 4 ms 2580 KB Output isn't correct
19 Incorrect 3 ms 2588 KB Output isn't correct
20 Incorrect 2 ms 2572 KB Output isn't correct
21 Incorrect 13 ms 2820 KB Output isn't correct
22 Incorrect 13 ms 2856 KB Output isn't correct
23 Incorrect 13 ms 2856 KB Output isn't correct
24 Incorrect 12 ms 2860 KB Output isn't correct
25 Incorrect 16 ms 2856 KB Output isn't correct
26 Incorrect 16 ms 3096 KB Output isn't correct
27 Incorrect 13 ms 2856 KB Output isn't correct
28 Incorrect 15 ms 2860 KB Output isn't correct
29 Incorrect 14 ms 2848 KB Output isn't correct
30 Incorrect 9 ms 2848 KB Output isn't correct
31 Incorrect 0 ms 2392 KB Output isn't correct
32 Incorrect 0 ms 2392 KB Output isn't correct