# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
97728 |
2019-02-17T19:52:49 Z |
dalgerok |
Gap (APIO16_gap) |
C++17 |
|
98 ms |
4088 KB |
#include<bits/stdc++.h>
#include "gap.h"
using namespace std;
long long a[400005];
long long findGap(int T, int N){
long long mn, mx, l = 0, r = 1e18, ans = 0;
int sz = 0;
if(T == 1){
int tl = 1, tr = N;
while(tl <= tr){
MinMax(l, r, &mn, &mx);
a[tl++] = mn;
a[tr--] = mx;
l = mn + 1;
r = mx - 1;
}
sz = N;
}
else{
MinMax(l, r, &mn, &mx);
long long shift = (mx + mn + N - 1) / N, xx, yy;
a[++sz] = mn;
l = mn + 1;
r = l + shift;
while(l < mx){
MinMax(l, min(r, mx - 1), &xx, &yy);
if(xx != -1){
a[++sz] = xx;
a[++sz] = yy;
}
l = r + 1;
r = l + shift;
}
a[++sz] = mx;
}
for(int i = 2; i <= sz; i++){
ans = max(ans, a[i] - a[i - 1]);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
512 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
3 ms |
384 KB |
Output is correct |
12 |
Correct |
3 ms |
420 KB |
Output is correct |
13 |
Correct |
3 ms |
384 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
13 ms |
1280 KB |
Output is correct |
17 |
Correct |
14 ms |
1152 KB |
Output is correct |
18 |
Correct |
14 ms |
1152 KB |
Output is correct |
19 |
Correct |
15 ms |
1152 KB |
Output is correct |
20 |
Correct |
10 ms |
896 KB |
Output is correct |
21 |
Correct |
51 ms |
3704 KB |
Output is correct |
22 |
Correct |
49 ms |
3772 KB |
Output is correct |
23 |
Correct |
52 ms |
3832 KB |
Output is correct |
24 |
Correct |
49 ms |
3704 KB |
Output is correct |
25 |
Correct |
43 ms |
3064 KB |
Output is correct |
26 |
Correct |
56 ms |
3832 KB |
Output is correct |
27 |
Correct |
52 ms |
3824 KB |
Output is correct |
28 |
Correct |
55 ms |
3704 KB |
Output is correct |
29 |
Correct |
63 ms |
3808 KB |
Output is correct |
30 |
Correct |
39 ms |
2552 KB |
Output is correct |
31 |
Correct |
2 ms |
384 KB |
Output is correct |
32 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
3 ms |
384 KB |
Output is correct |
12 |
Correct |
3 ms |
428 KB |
Output is correct |
13 |
Correct |
3 ms |
384 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
18 ms |
1400 KB |
Output is correct |
17 |
Correct |
18 ms |
1280 KB |
Output is correct |
18 |
Correct |
25 ms |
1280 KB |
Output is correct |
19 |
Correct |
21 ms |
1280 KB |
Output is correct |
20 |
Correct |
9 ms |
640 KB |
Output is correct |
21 |
Correct |
74 ms |
4060 KB |
Output is correct |
22 |
Correct |
68 ms |
4028 KB |
Output is correct |
23 |
Correct |
73 ms |
3964 KB |
Output is correct |
24 |
Correct |
90 ms |
4088 KB |
Output is correct |
25 |
Correct |
85 ms |
3964 KB |
Output is correct |
26 |
Correct |
74 ms |
3960 KB |
Output is correct |
27 |
Correct |
67 ms |
3960 KB |
Output is correct |
28 |
Correct |
67 ms |
3996 KB |
Output is correct |
29 |
Correct |
98 ms |
3960 KB |
Output is correct |
30 |
Correct |
34 ms |
1912 KB |
Output is correct |
31 |
Correct |
2 ms |
384 KB |
Output is correct |
32 |
Correct |
2 ms |
384 KB |
Output is correct |