#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);
if(root-> ans == -1) for(;;);
return root-> ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3030 ms |
344 KB |
Time limit exceeded |
2 |
Execution timed out |
3025 ms |
2392 KB |
Time limit exceeded |
3 |
Execution timed out |
3064 ms |
2392 KB |
Time limit exceeded |
4 |
Execution timed out |
3056 ms |
2392 KB |
Time limit exceeded |
5 |
Execution timed out |
3046 ms |
2392 KB |
Time limit exceeded |
6 |
Execution timed out |
3025 ms |
2392 KB |
Time limit exceeded |
7 |
Execution timed out |
3062 ms |
2392 KB |
Time limit exceeded |
8 |
Execution timed out |
3053 ms |
2392 KB |
Time limit exceeded |
9 |
Execution timed out |
3025 ms |
2392 KB |
Time limit exceeded |
10 |
Execution timed out |
3006 ms |
2392 KB |
Time limit exceeded |
11 |
Execution timed out |
3047 ms |
2392 KB |
Time limit exceeded |
12 |
Execution timed out |
3026 ms |
2392 KB |
Time limit exceeded |
13 |
Execution timed out |
3029 ms |
2392 KB |
Time limit exceeded |
14 |
Execution timed out |
3034 ms |
2392 KB |
Time limit exceeded |
15 |
Execution timed out |
3034 ms |
2392 KB |
Time limit exceeded |
16 |
Execution timed out |
3052 ms |
2576 KB |
Time limit exceeded |
17 |
Execution timed out |
3059 ms |
2832 KB |
Time limit exceeded |
18 |
Execution timed out |
3023 ms |
2584 KB |
Time limit exceeded |
19 |
Execution timed out |
3050 ms |
2584 KB |
Time limit exceeded |
20 |
Execution timed out |
3063 ms |
2568 KB |
Time limit exceeded |
21 |
Execution timed out |
3032 ms |
2856 KB |
Time limit exceeded |
22 |
Execution timed out |
3013 ms |
2860 KB |
Time limit exceeded |
23 |
Execution timed out |
3041 ms |
2852 KB |
Time limit exceeded |
24 |
Execution timed out |
3025 ms |
2860 KB |
Time limit exceeded |
25 |
Execution timed out |
3055 ms |
2860 KB |
Time limit exceeded |
26 |
Execution timed out |
3046 ms |
2776 KB |
Time limit exceeded |
27 |
Execution timed out |
3051 ms |
2860 KB |
Time limit exceeded |
28 |
Execution timed out |
3017 ms |
2672 KB |
Time limit exceeded |
29 |
Execution timed out |
3058 ms |
2772 KB |
Time limit exceeded |
30 |
Execution timed out |
3038 ms |
2852 KB |
Time limit exceeded |
31 |
Execution timed out |
3050 ms |
2392 KB |
Time limit exceeded |
32 |
Execution timed out |
3061 ms |
2392 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3051 ms |
2392 KB |
Time limit exceeded |
2 |
Execution timed out |
3021 ms |
2392 KB |
Time limit exceeded |
3 |
Execution timed out |
3035 ms |
2392 KB |
Time limit exceeded |
4 |
Execution timed out |
3051 ms |
2392 KB |
Time limit exceeded |
5 |
Execution timed out |
3029 ms |
2392 KB |
Time limit exceeded |
6 |
Execution timed out |
3055 ms |
2392 KB |
Time limit exceeded |
7 |
Execution timed out |
3013 ms |
2392 KB |
Time limit exceeded |
8 |
Execution timed out |
3038 ms |
2392 KB |
Time limit exceeded |
9 |
Execution timed out |
3017 ms |
2392 KB |
Time limit exceeded |
10 |
Execution timed out |
3067 ms |
2392 KB |
Time limit exceeded |
11 |
Execution timed out |
3053 ms |
2392 KB |
Time limit exceeded |
12 |
Execution timed out |
3041 ms |
2392 KB |
Time limit exceeded |
13 |
Execution timed out |
3042 ms |
2392 KB |
Time limit exceeded |
14 |
Execution timed out |
3033 ms |
2392 KB |
Time limit exceeded |
15 |
Execution timed out |
3059 ms |
2392 KB |
Time limit exceeded |
16 |
Execution timed out |
3053 ms |
2588 KB |
Time limit exceeded |
17 |
Execution timed out |
3014 ms |
2580 KB |
Time limit exceeded |
18 |
Execution timed out |
3033 ms |
2592 KB |
Time limit exceeded |
19 |
Execution timed out |
3040 ms |
2584 KB |
Time limit exceeded |
20 |
Execution timed out |
3008 ms |
2568 KB |
Time limit exceeded |
21 |
Execution timed out |
3041 ms |
2776 KB |
Time limit exceeded |
22 |
Execution timed out |
3050 ms |
2856 KB |
Time limit exceeded |
23 |
Execution timed out |
3043 ms |
2852 KB |
Time limit exceeded |
24 |
Execution timed out |
3034 ms |
2864 KB |
Time limit exceeded |
25 |
Execution timed out |
3100 ms |
2848 KB |
Time limit exceeded |
26 |
Execution timed out |
3046 ms |
2856 KB |
Time limit exceeded |
27 |
Execution timed out |
3007 ms |
2840 KB |
Time limit exceeded |
28 |
Execution timed out |
3056 ms |
2856 KB |
Time limit exceeded |
29 |
Execution timed out |
3050 ms |
2856 KB |
Time limit exceeded |
30 |
Execution timed out |
3022 ms |
2852 KB |
Time limit exceeded |
31 |
Execution timed out |
3053 ms |
2392 KB |
Time limit exceeded |
32 |
Execution timed out |
3011 ms |
2392 KB |
Time limit exceeded |