# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
262495 |
2020-08-13T01:44:24 Z |
yuma220284 |
Gap (APIO16_gap) |
C++14 |
|
75 ms |
1920 KB |
#include "gap.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long findGap(int T, int N) {
if (T == 1) {
vector<long long> A(N);
long long L = 0, R = 1000000000000000000;
for (int i = 0; i < (N + 1) / 2; i++) {
long long MN, MX;
MinMax(L, R, &MN, &MX);
A[i] = MN, A[N - 1 - i] = MX;
L = MN + 1, R = MX - 1;
}
long long ANS = 0;
for (int i = 0; i < N - 1; i++) {
ANS = max(ANS, A[i + 1] - A[i]);
}
return ANS;
}
else {
long long L = 0, R = 1000000000000000000;
long long MN, MX;
MinMax(L, R, &MN, &MX);
L = MN + 1, R = MX;
long long Size = (R - L + N - 2) / (N - 1);
long long Cur = MN;
long long ANS = 0;
for (long long i = 0; i <= N - 1; i++) {
MinMax(L + Size * i + 1, L + Size * (i + 1), &MN, &MX);
if (MN != -1) {
ANS = max(ANS, MN - Cur);
Cur = MX;
}
}
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 |
1 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 |
768 KB |
Output is correct |
19 |
Correct |
18 ms |
768 KB |
Output is correct |
20 |
Correct |
12 ms |
768 KB |
Output is correct |
21 |
Correct |
52 ms |
1912 KB |
Output is correct |
22 |
Correct |
53 ms |
1868 KB |
Output is correct |
23 |
Correct |
54 ms |
1912 KB |
Output is correct |
24 |
Correct |
51 ms |
1912 KB |
Output is correct |
25 |
Correct |
49 ms |
1920 KB |
Output is correct |
26 |
Correct |
58 ms |
1916 KB |
Output is correct |
27 |
Correct |
51 ms |
1916 KB |
Output is correct |
28 |
Correct |
52 ms |
1844 KB |
Output is correct |
29 |
Correct |
52 ms |
1920 KB |
Output is correct |
30 |
Correct |
39 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 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
512 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 |
1 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 |
19 ms |
512 KB |
Output is correct |
17 |
Correct |
19 ms |
512 KB |
Output is correct |
18 |
Correct |
16 ms |
512 KB |
Output is correct |
19 |
Correct |
16 ms |
512 KB |
Output is correct |
20 |
Correct |
8 ms |
512 KB |
Output is correct |
21 |
Correct |
68 ms |
1164 KB |
Output is correct |
22 |
Correct |
68 ms |
1144 KB |
Output is correct |
23 |
Correct |
68 ms |
1148 KB |
Output is correct |
24 |
Correct |
75 ms |
1144 KB |
Output is correct |
25 |
Correct |
61 ms |
1144 KB |
Output is correct |
26 |
Correct |
71 ms |
1156 KB |
Output is correct |
27 |
Correct |
69 ms |
1144 KB |
Output is correct |
28 |
Correct |
70 ms |
1060 KB |
Output is correct |
29 |
Correct |
68 ms |
1144 KB |
Output is correct |
30 |
Correct |
37 ms |
1152 KB |
Output is correct |
31 |
Correct |
0 ms |
384 KB |
Output is correct |
32 |
Correct |
0 ms |
384 KB |
Output is correct |