# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
262377 |
2020-08-12T18:04:01 Z |
my99n |
Gap (APIO16_gap) |
C++14 |
|
68 ms |
1976 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
vector<long long> a;
void findarr (long long low, long long high) {
long long mnl, mxl, mnr, mxr;
int mid = (low+high)/2;
MinMax(low, mid, &mnl, &mxl);
MinMax(mid+1, high, &mnr, &mxr);
if (mnl != -1) {
a.push_back(mnl);
if (mxl != mnl) a.push_back(mxl);
}
if (mnr != -1) {
a.push_back(mnr);
if (mxr != mnr) a.push_back(mxr);
}
if (mnl != mxl) findarr(mnl+1, mxl-1);
if (mnr != mxr) findarr(mnr+1, mxr-1);
}
long long findGap(int T, int N) {
long long ans = 0;
if (T == 1) {
a.resize(N);
long long mn, mx;
long long l = 0, r = 1e18;
int indl = 0, indr = N-1;
while (indl <= indr) {
MinMax(l, r, &mn, &mx);
if (mn != -1) {
a[indl++] = mn;
a[indr--] = mx;
}
l = mn+1; r = mx-1;
}
for (int i = 1; i < N; i++) {
ans = max(ans, a[i]-a[i-1]);
}
}
else {
findarr(0, 1e18);
sort(a.begin(), a.end());
for (int i = 1; i < N; i++) {
ans = max(ans, a[i]-a[i-1]);
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
13 ms |
768 KB |
Output is correct |
17 |
Correct |
13 ms |
784 KB |
Output is correct |
18 |
Correct |
13 ms |
744 KB |
Output is correct |
19 |
Correct |
12 ms |
768 KB |
Output is correct |
20 |
Correct |
9 ms |
768 KB |
Output is correct |
21 |
Correct |
52 ms |
1888 KB |
Output is correct |
22 |
Correct |
68 ms |
1912 KB |
Output is correct |
23 |
Correct |
61 ms |
1944 KB |
Output is correct |
24 |
Correct |
52 ms |
1872 KB |
Output is correct |
25 |
Correct |
43 ms |
1912 KB |
Output is correct |
26 |
Correct |
52 ms |
1932 KB |
Output is correct |
27 |
Correct |
51 ms |
1844 KB |
Output is correct |
28 |
Correct |
53 ms |
1912 KB |
Output is correct |
29 |
Correct |
55 ms |
1976 KB |
Output is correct |
30 |
Correct |
42 ms |
1912 KB |
Output is correct |
31 |
Correct |
0 ms |
384 KB |
Output is correct |
32 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
384 KB |
Execution failed because the return code was nonzero |
2 |
Runtime error |
1 ms |
384 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
0 ms |
384 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
1 ms |
384 KB |
Execution failed because the return code was nonzero |
5 |
Runtime error |
0 ms |
384 KB |
Execution failed because the return code was nonzero |
6 |
Runtime error |
0 ms |
384 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
1 ms |
384 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
1 ms |
384 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
0 ms |
384 KB |
Execution failed because the return code was nonzero |
10 |
Runtime error |
1 ms |
384 KB |
Execution failed because the return code was nonzero |
11 |
Runtime error |
1 ms |
384 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
1 ms |
384 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
1 ms |
384 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
1 ms |
384 KB |
Execution failed because the return code was nonzero |
15 |
Runtime error |
1 ms |
384 KB |
Execution failed because the return code was nonzero |
16 |
Runtime error |
7 ms |
540 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
9 ms |
512 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
7 ms |
512 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
8 ms |
512 KB |
Execution failed because the return code was nonzero |
20 |
Runtime error |
4 ms |
512 KB |
Execution failed because the return code was nonzero |
21 |
Runtime error |
29 ms |
1144 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
32 ms |
1152 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
34 ms |
1144 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
28 ms |
1144 KB |
Execution failed because the return code was nonzero |
25 |
Runtime error |
20 ms |
1144 KB |
Execution failed because the return code was nonzero |
26 |
Runtime error |
29 ms |
1152 KB |
Execution failed because the return code was nonzero |
27 |
Runtime error |
29 ms |
1144 KB |
Execution failed because the return code was nonzero |
28 |
Runtime error |
28 ms |
1144 KB |
Execution failed because the return code was nonzero |
29 |
Runtime error |
34 ms |
1144 KB |
Execution failed because the return code was nonzero |
30 |
Runtime error |
17 ms |
1152 KB |
Execution failed because the return code was nonzero |
31 |
Runtime error |
1 ms |
384 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
0 ms |
384 KB |
Execution failed because the return code was nonzero |