# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
61156 |
2018-07-25T09:27:49 Z |
Eae02 |
Gap (APIO16_gap) |
C++14 |
|
86 ms |
1516 KB |
#include "gap.h"
#include <bits/stdc++.h>
using ll = long long;
ll gMaxDiff = 0;
void maxDiff(ll min, ll max)
{
ll mid = min + (max - min) / 2;
ll s1Min, s1Max;
MinMax(min + 1, mid, &s1Min, &s1Max);
bool s1Pop = s1Min != -1;
ll s2Min, s2Max;
MinMax(mid + 1, max - 1, &s2Min, &s2Max);
bool s2Pop = s2Min != -1;
if (s1Pop && s2Pop)
{
gMaxDiff = std::max(gMaxDiff, s2Min - s1Max);
gMaxDiff = std::max(gMaxDiff, s1Min - min);
gMaxDiff = std::max(gMaxDiff, max - s2Max);
}
else if (!s1Pop && s2Pop)
{
gMaxDiff = std::max(gMaxDiff, s2Min - min);
gMaxDiff = std::max(gMaxDiff, max - s2Max);
}
else if (s1Pop && !s2Pop)
{
gMaxDiff = std::max(gMaxDiff, s1Min - min);
gMaxDiff = std::max(gMaxDiff, max - s1Max);
}
else if (!s1Pop && !s2Pop)
{
gMaxDiff = std::max(gMaxDiff, max - min);
}
if (s1Pop && s1Max - s1Min > gMaxDiff)
maxDiff(s1Min, s1Max);
if (s2Pop && s2Max - s2Min > gMaxDiff)
maxDiff(s2Min, s2Max);
}
long long findGap(int T, int N)
{
ll min, max;
MinMax(0, 1000000000000000000, &min, &max);
maxDiff(min, max);
return gMaxDiff;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Output isn't correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
2 ms |
564 KB |
Output is correct |
4 |
Correct |
3 ms |
564 KB |
Output is correct |
5 |
Incorrect |
3 ms |
564 KB |
Output isn't correct |
6 |
Correct |
3 ms |
564 KB |
Output is correct |
7 |
Correct |
2 ms |
564 KB |
Output is correct |
8 |
Correct |
3 ms |
596 KB |
Output is correct |
9 |
Correct |
4 ms |
596 KB |
Output is correct |
10 |
Correct |
3 ms |
596 KB |
Output is correct |
11 |
Correct |
3 ms |
596 KB |
Output is correct |
12 |
Correct |
4 ms |
596 KB |
Output is correct |
13 |
Correct |
3 ms |
600 KB |
Output is correct |
14 |
Correct |
3 ms |
708 KB |
Output is correct |
15 |
Incorrect |
3 ms |
708 KB |
Output isn't correct |
16 |
Correct |
18 ms |
724 KB |
Output is correct |
17 |
Correct |
16 ms |
724 KB |
Output is correct |
18 |
Correct |
13 ms |
724 KB |
Output is correct |
19 |
Correct |
15 ms |
724 KB |
Output is correct |
20 |
Correct |
6 ms |
724 KB |
Output is correct |
21 |
Correct |
42 ms |
1516 KB |
Output is correct |
22 |
Correct |
50 ms |
1516 KB |
Output is correct |
23 |
Correct |
44 ms |
1516 KB |
Output is correct |
24 |
Correct |
51 ms |
1516 KB |
Output is correct |
25 |
Incorrect |
86 ms |
1516 KB |
Output isn't correct |
26 |
Correct |
48 ms |
1516 KB |
Output is correct |
27 |
Correct |
59 ms |
1516 KB |
Output is correct |
28 |
Correct |
43 ms |
1516 KB |
Output is correct |
29 |
Correct |
43 ms |
1516 KB |
Output is correct |
30 |
Correct |
17 ms |
1516 KB |
Output is correct |
31 |
Correct |
2 ms |
1516 KB |
Output is correct |
32 |
Correct |
2 ms |
1516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1516 KB |
Output is correct |
2 |
Correct |
2 ms |
1516 KB |
Output is correct |
3 |
Correct |
2 ms |
1516 KB |
Output is correct |
4 |
Correct |
3 ms |
1516 KB |
Output is correct |
5 |
Partially correct |
3 ms |
1516 KB |
Partially correct |
6 |
Partially correct |
2 ms |
1516 KB |
Partially correct |
7 |
Partially correct |
3 ms |
1516 KB |
Partially correct |
8 |
Partially correct |
3 ms |
1516 KB |
Partially correct |
9 |
Partially correct |
2 ms |
1516 KB |
Partially correct |
10 |
Correct |
2 ms |
1516 KB |
Output is correct |
11 |
Partially correct |
4 ms |
1516 KB |
Partially correct |
12 |
Partially correct |
3 ms |
1516 KB |
Partially correct |
13 |
Partially correct |
3 ms |
1516 KB |
Partially correct |
14 |
Partially correct |
4 ms |
1516 KB |
Partially correct |
15 |
Partially correct |
3 ms |
1516 KB |
Partially correct |
16 |
Partially correct |
14 ms |
1516 KB |
Partially correct |
17 |
Partially correct |
13 ms |
1516 KB |
Partially correct |
18 |
Partially correct |
15 ms |
1516 KB |
Partially correct |
19 |
Partially correct |
15 ms |
1516 KB |
Partially correct |
20 |
Correct |
8 ms |
1516 KB |
Output is correct |
21 |
Partially correct |
50 ms |
1516 KB |
Partially correct |
22 |
Partially correct |
45 ms |
1516 KB |
Partially correct |
23 |
Partially correct |
49 ms |
1516 KB |
Partially correct |
24 |
Partially correct |
71 ms |
1516 KB |
Partially correct |
25 |
Partially correct |
67 ms |
1516 KB |
Partially correct |
26 |
Partially correct |
62 ms |
1516 KB |
Partially correct |
27 |
Partially correct |
47 ms |
1516 KB |
Partially correct |
28 |
Partially correct |
50 ms |
1516 KB |
Partially correct |
29 |
Partially correct |
48 ms |
1516 KB |
Partially correct |
30 |
Correct |
19 ms |
1516 KB |
Output is correct |
31 |
Correct |
3 ms |
1516 KB |
Output is correct |
32 |
Correct |
3 ms |
1516 KB |
Output is correct |