# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
68204 |
2018-08-16T08:17:04 Z |
gusfring |
Gap (APIO16_gap) |
C++14 |
|
148 ms |
2176 KB |
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
const int MAXN = 1e5 + 5;
typedef long long ll;
long long A[MAXN], res;
long long findGap2(int T, int N){
MinMax(0, 1e18, &A[1], &A[N]);
for(int i=2, j=N-1; i<=j; ++i, --j) MinMax(A[i - 1] + 1, A[j + 1] - 1, &A[i], &A[j]);
for(int i=2; i<=N; i++) res = max(res, A[i] - A[i - 1]);
return res;
}
ll mn, mx;
ll solve(ll lo, ll hi){
if(lo >= hi) return 0;
unsigned long long x = (1LLU * lo + hi) / 2;
ll mid = (ll)(x), mn1 = -1, mx1 = -1, mn2 = -1, mx2 = -1;
if(lo < mid) MinMax(lo, mid, &mn1, &mx1);
if(mid + 1 < hi) MinMax(mid + 1, hi, &mn2, &mx2);
ll res = 0, r1 = 0, r2 = 0;
if(mx1 != -1 && mx2 != -1) res = mn2 - mx1;
if(mx2 != -1 && mx2 != mn2) r2 = solve(mn2, mx2);
if(mx1 != -1 && mx1 != mn1) r1 = solve(mn1, mx1);
return max({res, r1, r2});
}
long long findGap(int T, int N){
if(T == 1){
MinMax(0, 1e18, &mn, &mx);
return solve(mn, mx);
}
return findGap2(T, N);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
248 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
484 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
564 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
564 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
564 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
564 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
564 KB |
Output isn't correct |
8 |
Incorrect |
3 ms |
564 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
564 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
596 KB |
Output isn't correct |
11 |
Incorrect |
4 ms |
596 KB |
Output isn't correct |
12 |
Incorrect |
3 ms |
596 KB |
Output isn't correct |
13 |
Incorrect |
4 ms |
620 KB |
Output isn't correct |
14 |
Incorrect |
4 ms |
620 KB |
Output isn't correct |
15 |
Incorrect |
4 ms |
644 KB |
Output isn't correct |
16 |
Incorrect |
36 ms |
864 KB |
Output isn't correct |
17 |
Incorrect |
32 ms |
864 KB |
Output isn't correct |
18 |
Incorrect |
33 ms |
864 KB |
Output isn't correct |
19 |
Incorrect |
35 ms |
864 KB |
Output isn't correct |
20 |
Incorrect |
22 ms |
864 KB |
Output isn't correct |
21 |
Incorrect |
145 ms |
1416 KB |
Output isn't correct |
22 |
Incorrect |
130 ms |
1416 KB |
Output isn't correct |
23 |
Incorrect |
139 ms |
1416 KB |
Output isn't correct |
24 |
Incorrect |
148 ms |
1416 KB |
Output isn't correct |
25 |
Incorrect |
144 ms |
1416 KB |
Output isn't correct |
26 |
Incorrect |
141 ms |
1600 KB |
Output isn't correct |
27 |
Incorrect |
137 ms |
1600 KB |
Output isn't correct |
28 |
Incorrect |
131 ms |
1600 KB |
Output isn't correct |
29 |
Incorrect |
133 ms |
1600 KB |
Output isn't correct |
30 |
Incorrect |
86 ms |
1600 KB |
Output isn't correct |
31 |
Incorrect |
2 ms |
1600 KB |
Output isn't correct |
32 |
Incorrect |
2 ms |
1600 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1600 KB |
Output is correct |
2 |
Partially correct |
2 ms |
1600 KB |
Partially correct |
3 |
Partially correct |
2 ms |
1600 KB |
Partially correct |
4 |
Partially correct |
2 ms |
1600 KB |
Partially correct |
5 |
Partially correct |
2 ms |
1600 KB |
Partially correct |
6 |
Partially correct |
2 ms |
1600 KB |
Partially correct |
7 |
Partially correct |
2 ms |
1600 KB |
Partially correct |
8 |
Partially correct |
2 ms |
1600 KB |
Partially correct |
9 |
Partially correct |
2 ms |
1600 KB |
Partially correct |
10 |
Partially correct |
3 ms |
1600 KB |
Partially correct |
11 |
Partially correct |
3 ms |
1600 KB |
Partially correct |
12 |
Partially correct |
3 ms |
1600 KB |
Partially correct |
13 |
Partially correct |
3 ms |
1600 KB |
Partially correct |
14 |
Partially correct |
4 ms |
1600 KB |
Partially correct |
15 |
Partially correct |
3 ms |
1600 KB |
Partially correct |
16 |
Partially correct |
16 ms |
1600 KB |
Partially correct |
17 |
Partially correct |
18 ms |
1600 KB |
Partially correct |
18 |
Partially correct |
17 ms |
1600 KB |
Partially correct |
19 |
Partially correct |
17 ms |
1600 KB |
Partially correct |
20 |
Partially correct |
13 ms |
1600 KB |
Partially correct |
21 |
Incorrect |
61 ms |
2176 KB |
Expected int32, but "2500100000" found |
22 |
Incorrect |
61 ms |
2176 KB |
Expected int32, but "2500100000" found |
23 |
Incorrect |
66 ms |
2176 KB |
Expected int32, but "2500100000" found |
24 |
Incorrect |
62 ms |
2176 KB |
Expected int32, but "2500100000" found |
25 |
Incorrect |
52 ms |
2176 KB |
Expected int32, but "2500100000" found |
26 |
Incorrect |
62 ms |
2176 KB |
Expected int32, but "2500100000" found |
27 |
Incorrect |
64 ms |
2176 KB |
Expected int32, but "2500100000" found |
28 |
Incorrect |
57 ms |
2176 KB |
Expected int32, but "2500100000" found |
29 |
Incorrect |
75 ms |
2176 KB |
Expected int32, but "2500100000" found |
30 |
Incorrect |
47 ms |
2176 KB |
Expected int32, but "2500100000" found |
31 |
Partially correct |
3 ms |
2176 KB |
Partially correct |
32 |
Partially correct |
3 ms |
2176 KB |
Partially correct |