#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 |
3038 ms |
344 KB |
Time limit exceeded |
2 |
Execution timed out |
3036 ms |
2392 KB |
Time limit exceeded |
3 |
Execution timed out |
3010 ms |
2392 KB |
Time limit exceeded |
4 |
Execution timed out |
3022 ms |
2392 KB |
Time limit exceeded |
5 |
Execution timed out |
3074 ms |
2392 KB |
Time limit exceeded |
6 |
Execution timed out |
3012 ms |
2392 KB |
Time limit exceeded |
7 |
Execution timed out |
3026 ms |
2392 KB |
Time limit exceeded |
8 |
Execution timed out |
3053 ms |
2392 KB |
Time limit exceeded |
9 |
Execution timed out |
3041 ms |
2392 KB |
Time limit exceeded |
10 |
Execution timed out |
3023 ms |
2392 KB |
Time limit exceeded |
11 |
Execution timed out |
3044 ms |
2392 KB |
Time limit exceeded |
12 |
Execution timed out |
3048 ms |
2392 KB |
Time limit exceeded |
13 |
Execution timed out |
3050 ms |
2392 KB |
Time limit exceeded |
14 |
Execution timed out |
3095 ms |
2392 KB |
Time limit exceeded |
15 |
Execution timed out |
3073 ms |
2392 KB |
Time limit exceeded |
16 |
Execution timed out |
3049 ms |
2584 KB |
Time limit exceeded |
17 |
Execution timed out |
3072 ms |
2584 KB |
Time limit exceeded |
18 |
Execution timed out |
3046 ms |
2392 KB |
Time limit exceeded |
19 |
Execution timed out |
3012 ms |
2580 KB |
Time limit exceeded |
20 |
Execution timed out |
3098 ms |
2572 KB |
Time limit exceeded |
21 |
Execution timed out |
3094 ms |
2856 KB |
Time limit exceeded |
22 |
Execution timed out |
3059 ms |
2648 KB |
Time limit exceeded |
23 |
Execution timed out |
3017 ms |
2852 KB |
Time limit exceeded |
24 |
Execution timed out |
3007 ms |
2856 KB |
Time limit exceeded |
25 |
Execution timed out |
3008 ms |
2852 KB |
Time limit exceeded |
26 |
Execution timed out |
3009 ms |
2856 KB |
Time limit exceeded |
27 |
Execution timed out |
3049 ms |
2856 KB |
Time limit exceeded |
28 |
Execution timed out |
3058 ms |
2864 KB |
Time limit exceeded |
29 |
Execution timed out |
3070 ms |
2856 KB |
Time limit exceeded |
30 |
Execution timed out |
3099 ms |
2848 KB |
Time limit exceeded |
31 |
Execution timed out |
3061 ms |
2392 KB |
Time limit exceeded |
32 |
Execution timed out |
3041 ms |
2392 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3011 ms |
2392 KB |
Time limit exceeded |
2 |
Execution timed out |
3039 ms |
2392 KB |
Time limit exceeded |
3 |
Execution timed out |
3011 ms |
2392 KB |
Time limit exceeded |
4 |
Execution timed out |
3064 ms |
2392 KB |
Time limit exceeded |
5 |
Execution timed out |
3049 ms |
2392 KB |
Time limit exceeded |
6 |
Execution timed out |
3051 ms |
2392 KB |
Time limit exceeded |
7 |
Execution timed out |
3019 ms |
2392 KB |
Time limit exceeded |
8 |
Execution timed out |
3034 ms |
2392 KB |
Time limit exceeded |
9 |
Execution timed out |
3025 ms |
2392 KB |
Time limit exceeded |
10 |
Execution timed out |
3065 ms |
2392 KB |
Time limit exceeded |
11 |
Execution timed out |
3035 ms |
2392 KB |
Time limit exceeded |
12 |
Execution timed out |
3030 ms |
2392 KB |
Time limit exceeded |
13 |
Execution timed out |
3026 ms |
2392 KB |
Time limit exceeded |
14 |
Execution timed out |
3065 ms |
2392 KB |
Time limit exceeded |
15 |
Execution timed out |
3061 ms |
2392 KB |
Time limit exceeded |
16 |
Execution timed out |
3036 ms |
2584 KB |
Time limit exceeded |
17 |
Execution timed out |
3048 ms |
2580 KB |
Time limit exceeded |
18 |
Execution timed out |
3061 ms |
2584 KB |
Time limit exceeded |
19 |
Execution timed out |
3017 ms |
2580 KB |
Time limit exceeded |
20 |
Execution timed out |
3028 ms |
2568 KB |
Time limit exceeded |
21 |
Execution timed out |
3079 ms |
2852 KB |
Time limit exceeded |
22 |
Execution timed out |
3046 ms |
2856 KB |
Time limit exceeded |
23 |
Execution timed out |
3024 ms |
2852 KB |
Time limit exceeded |
24 |
Execution timed out |
3062 ms |
2900 KB |
Time limit exceeded |
25 |
Execution timed out |
3050 ms |
2852 KB |
Time limit exceeded |
26 |
Execution timed out |
3068 ms |
2860 KB |
Time limit exceeded |
27 |
Execution timed out |
3012 ms |
2856 KB |
Time limit exceeded |
28 |
Execution timed out |
3055 ms |
2852 KB |
Time limit exceeded |
29 |
Execution timed out |
3045 ms |
2852 KB |
Time limit exceeded |
30 |
Execution timed out |
3032 ms |
2848 KB |
Time limit exceeded |
31 |
Execution timed out |
3054 ms |
2392 KB |
Time limit exceeded |
32 |
Execution timed out |
3073 ms |
2392 KB |
Time limit exceeded |