# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
115444 |
2019-06-07T13:40:01 Z |
nvmdava |
Gap (APIO16_gap) |
C++17 |
|
73 ms |
1968 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
long long a[100005];
long long findGap(int T, int N)
{
if(T == 1){
a[0] = 0;
int r = N;
a[N + 1] = 1000000000000000006;
for(int l = 1; l <= r; l++){
MinMax(a[l - 1] + 1, a[r + 1] - 1, &a[l], &a[r]);
r--;
}
long long res = 0;
for(int l = 1; l < N; l++){
res = max(res, a[l + 1] - a[l]);
}
return res;
} else {
long long s, t;
MinMax(1, 1000000000000000000, &s, &t);
long long l, r;
l = s + 1;
long long sz = (t - s + 1) / N;
long long lf = s, res = 0;
long long a, b;
while(l < t){
r = l + sz;
MinMax(l, r, &a, &b);
if(a != -1) res = max(res, a - lf);
if(b != -1) lf = b;
l = r + 1;
}
res = max(res, t - lf);
return res;
}
}
# |
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 |
380 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 |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
3 ms |
384 KB |
Output is correct |
13 |
Correct |
3 ms |
512 KB |
Output is correct |
14 |
Correct |
18 ms |
384 KB |
Output is correct |
15 |
Correct |
2 ms |
384 KB |
Output is correct |
16 |
Correct |
16 ms |
768 KB |
Output is correct |
17 |
Correct |
15 ms |
768 KB |
Output is correct |
18 |
Correct |
16 ms |
768 KB |
Output is correct |
19 |
Correct |
14 ms |
768 KB |
Output is correct |
20 |
Correct |
12 ms |
768 KB |
Output is correct |
21 |
Correct |
50 ms |
1912 KB |
Output is correct |
22 |
Correct |
58 ms |
1884 KB |
Output is correct |
23 |
Correct |
49 ms |
1912 KB |
Output is correct |
24 |
Correct |
50 ms |
1912 KB |
Output is correct |
25 |
Correct |
45 ms |
1920 KB |
Output is correct |
26 |
Correct |
48 ms |
1968 KB |
Output is correct |
27 |
Correct |
47 ms |
1912 KB |
Output is correct |
28 |
Correct |
48 ms |
1912 KB |
Output is correct |
29 |
Correct |
46 ms |
1912 KB |
Output is correct |
30 |
Correct |
36 ms |
1912 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 |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
3 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
384 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 |
16 ms |
512 KB |
Output is correct |
17 |
Correct |
17 ms |
512 KB |
Output is correct |
18 |
Correct |
17 ms |
512 KB |
Output is correct |
19 |
Correct |
17 ms |
512 KB |
Output is correct |
20 |
Correct |
8 ms |
640 KB |
Output is correct |
21 |
Correct |
63 ms |
1152 KB |
Output is correct |
22 |
Correct |
63 ms |
1116 KB |
Output is correct |
23 |
Correct |
64 ms |
1152 KB |
Output is correct |
24 |
Correct |
73 ms |
1272 KB |
Output is correct |
25 |
Correct |
59 ms |
1152 KB |
Output is correct |
26 |
Correct |
65 ms |
1144 KB |
Output is correct |
27 |
Correct |
63 ms |
1128 KB |
Output is correct |
28 |
Correct |
65 ms |
1144 KB |
Output is correct |
29 |
Correct |
64 ms |
1180 KB |
Output is correct |
30 |
Correct |
32 ms |
1152 KB |
Output is correct |
31 |
Correct |
2 ms |
384 KB |
Output is correct |
32 |
Correct |
2 ms |
384 KB |
Output is correct |