# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
262375 |
2020-08-12T18:00:50 Z |
my99n |
Gap (APIO16_gap) |
C++14 |
|
101 ms |
10724 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, low, &mnl, &mxl);
MinMax(mid+1, high, &mnr, &mxr);
if (mnl != -1) {
a.push_back(mnl);
a.push_back(mxl);
}
if (mnr != -1) {
a.push_back(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 |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 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 |
0 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 |
1 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 |
15 ms |
768 KB |
Output is correct |
18 |
Correct |
13 ms |
760 KB |
Output is correct |
19 |
Correct |
13 ms |
768 KB |
Output is correct |
20 |
Correct |
9 ms |
768 KB |
Output is correct |
21 |
Correct |
50 ms |
1912 KB |
Output is correct |
22 |
Correct |
49 ms |
1912 KB |
Output is correct |
23 |
Correct |
50 ms |
1920 KB |
Output is correct |
24 |
Correct |
56 ms |
1920 KB |
Output is correct |
25 |
Correct |
42 ms |
1912 KB |
Output is correct |
26 |
Correct |
50 ms |
1912 KB |
Output is correct |
27 |
Correct |
53 ms |
1912 KB |
Output is correct |
28 |
Correct |
72 ms |
1912 KB |
Output is correct |
29 |
Correct |
52 ms |
1884 KB |
Output is correct |
30 |
Correct |
41 ms |
1912 KB |
Output is correct |
31 |
Correct |
1 ms |
384 KB |
Output is correct |
32 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
10 |
Runtime error |
0 ms |
384 KB |
Execution failed because the return code was nonzero |
11 |
Incorrect |
1 ms |
512 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
512 KB |
Output isn't correct |
13 |
Incorrect |
2 ms |
512 KB |
Output isn't correct |
14 |
Incorrect |
2 ms |
640 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
16 |
Incorrect |
25 ms |
3064 KB |
Output isn't correct |
17 |
Incorrect |
20 ms |
2936 KB |
Output isn't correct |
18 |
Incorrect |
20 ms |
3064 KB |
Output isn't correct |
19 |
Incorrect |
21 ms |
3052 KB |
Output isn't correct |
20 |
Runtime error |
4 ms |
512 KB |
Execution failed because the return code was nonzero |
21 |
Incorrect |
87 ms |
10596 KB |
Expected int32, but "5000250000" found |
22 |
Incorrect |
95 ms |
10600 KB |
Expected int32, but "5000250000" found |
23 |
Incorrect |
95 ms |
10600 KB |
Expected int32, but "5000250000" found |
24 |
Incorrect |
89 ms |
10600 KB |
Expected int32, but "5000250000" found |
25 |
Incorrect |
94 ms |
10724 KB |
Expected int32, but "4974090509" found |
26 |
Incorrect |
87 ms |
10596 KB |
Expected int32, but "5000250000" found |
27 |
Incorrect |
101 ms |
10712 KB |
Expected int32, but "5000250000" found |
28 |
Incorrect |
92 ms |
10724 KB |
Expected int32, but "5000250000" found |
29 |
Incorrect |
87 ms |
10600 KB |
Expected int32, but "5000250000" found |
30 |
Runtime error |
17 ms |
1152 KB |
Execution failed because the return code was nonzero |
31 |
Partially correct |
0 ms |
384 KB |
Partially correct |
32 |
Partially correct |
0 ms |
384 KB |
Partially correct |