#include "gap.h"
#include <algorithm>
using namespace std;
long long a[100009];
long long findGap(int T, int N)
{
if (T == 1) {
long long L = 0, R = 1000000000000000000LL, s, t, cnt = 0;
while (L != R) {
MinMax(L, R, &s, &t);
L = s; R = t;
if (L != -1) { a[cnt + 1] = L; a[N - cnt] = R; }
cnt++; L++; R--;
}
if (L >= 0) a[cnt + 1] = L;
long long maxn = 0;
for (int i = 1; i <= N - 1; i++) maxn = max(maxn, a[i + 1] - a[i]);
return maxn;
}
if (T == 2) {
long long L = 0, R = 1000000000000000000LL, s, t, cnt = 0;
while (L != R) {
MinMax(L, R, &s, &t);
L = s; R = t;
if (L != -1) { a[cnt + 1] = L; a[N - cnt] = R; }
cnt++; L++; R--;
}
if (L >= 0) a[cnt + 1] = L;
long long maxn = 0;
for (int i = 1; i <= N - 1; i++) maxn = max(maxn, a[i + 1] - a[i]);
return maxn;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
632 KB |
Execution failed because the return code was nonzero |
2 |
Runtime error |
2 ms |
632 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
2 ms |
632 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
2 ms |
704 KB |
Execution failed because the return code was nonzero |
5 |
Runtime error |
2 ms |
776 KB |
Execution failed because the return code was nonzero |
6 |
Runtime error |
2 ms |
868 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
2 ms |
868 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
2 ms |
888 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
2 ms |
892 KB |
Execution failed because the return code was nonzero |
10 |
Runtime error |
2 ms |
892 KB |
Execution failed because the return code was nonzero |
11 |
Runtime error |
3 ms |
900 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
3 ms |
1008 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
3 ms |
1008 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
2 ms |
1016 KB |
Execution failed because the return code was nonzero |
15 |
Runtime error |
2 ms |
1044 KB |
Execution failed because the return code was nonzero |
16 |
Runtime error |
16 ms |
1920 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
15 ms |
2292 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
15 ms |
2772 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
17 ms |
3240 KB |
Execution failed because the return code was nonzero |
20 |
Runtime error |
11 ms |
3496 KB |
Execution failed because the return code was nonzero |
21 |
Runtime error |
56 ms |
6440 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
59 ms |
8304 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
57 ms |
10124 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
57 ms |
11968 KB |
Execution failed because the return code was nonzero |
25 |
Runtime error |
47 ms |
13188 KB |
Execution failed because the return code was nonzero |
26 |
Runtime error |
56 ms |
15044 KB |
Execution failed because the return code was nonzero |
27 |
Runtime error |
58 ms |
17144 KB |
Execution failed because the return code was nonzero |
28 |
Runtime error |
60 ms |
18732 KB |
Execution failed because the return code was nonzero |
29 |
Runtime error |
60 ms |
20576 KB |
Execution failed because the return code was nonzero |
30 |
Runtime error |
42 ms |
21284 KB |
Execution failed because the return code was nonzero |
31 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
2 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
5 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
6 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
10 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
11 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
3 ms |
21284 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
2 ms |
21284 KB |
Execution failed because the return code was nonzero |
15 |
Runtime error |
3 ms |
21284 KB |
Execution failed because the return code was nonzero |
16 |
Runtime error |
15 ms |
21284 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
15 ms |
21284 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
16 ms |
21668 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
15 ms |
22132 KB |
Execution failed because the return code was nonzero |
20 |
Runtime error |
11 ms |
22340 KB |
Execution failed because the return code was nonzero |
21 |
Runtime error |
56 ms |
25284 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
57 ms |
27176 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
57 ms |
29072 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
83 ms |
30932 KB |
Execution failed because the return code was nonzero |
25 |
Runtime error |
49 ms |
32144 KB |
Execution failed because the return code was nonzero |
26 |
Runtime error |
65 ms |
33924 KB |
Execution failed because the return code was nonzero |
27 |
Runtime error |
57 ms |
35824 KB |
Execution failed because the return code was nonzero |
28 |
Runtime error |
58 ms |
37856 KB |
Execution failed because the return code was nonzero |
29 |
Runtime error |
58 ms |
39568 KB |
Execution failed because the return code was nonzero |
30 |
Runtime error |
41 ms |
40276 KB |
Execution failed because the return code was nonzero |
31 |
Runtime error |
2 ms |
40276 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
2 ms |
40276 KB |
Execution failed because the return code was nonzero |