Submission #68201

# Submission time Handle Problem Language Result Execution time Memory
68201 2018-08-16T08:11:44 Z gusfring Gap (APIO16_gap) C++14
13.7993 / 100
178 ms 1532 KB
#include <bits/stdc++.h>
#include "gap.h"

using namespace std;

typedef long long ll;
const int MAXN = 1e5 + 5;
const ll MAXA = 1000000000000000000LL;

ll mn, mx;

ll solve(ll lo, ll hi){
	if(lo >= hi) return 0;
	unsigned long long x = (1LLU * lo + hi) / 2;
	ll mid = (ll)(x), mn1 = -1, mx1 = -1, mn2 = -1, mx2 = -1;
	if(lo < mid) MinMax(lo, mid, &mn1, &mx1);
	if(mid + 1 < hi) MinMax(mid + 1, hi, &mn2, &mx2);
	ll res = 0, r1 = 0, r2 = 0;
	if(mx1 != -1 && mx2 != -1) res = mn2 - mx1;
	if(mx2 != -1 && mx2 != mn2) r2 = solve(mn2, mx2);
	if(mx1 != -1 && mx1 != mn1) r1 = solve(mn1, mx1);
	return max({res, r1, r2});
}

long long findGap(int T, int N){
	MinMax(0, MAXA, &mn, &mx);
	return solve(mn, mx);
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Incorrect 2 ms 472 KB Output isn't correct
3 Incorrect 2 ms 472 KB Output isn't correct
4 Incorrect 2 ms 472 KB Output isn't correct
5 Incorrect 3 ms 472 KB Output isn't correct
6 Incorrect 3 ms 492 KB Output isn't correct
7 Incorrect 3 ms 492 KB Output isn't correct
8 Incorrect 2 ms 568 KB Output isn't correct
9 Incorrect 2 ms 696 KB Output isn't correct
10 Incorrect 2 ms 696 KB Output isn't correct
11 Incorrect 4 ms 696 KB Output isn't correct
12 Incorrect 4 ms 696 KB Output isn't correct
13 Incorrect 4 ms 696 KB Output isn't correct
14 Incorrect 5 ms 696 KB Output isn't correct
15 Incorrect 4 ms 696 KB Output isn't correct
16 Incorrect 34 ms 744 KB Output isn't correct
17 Incorrect 35 ms 744 KB Output isn't correct
18 Incorrect 39 ms 748 KB Output isn't correct
19 Incorrect 33 ms 748 KB Output isn't correct
20 Incorrect 19 ms 748 KB Output isn't correct
21 Incorrect 132 ms 1432 KB Output isn't correct
22 Incorrect 127 ms 1516 KB Output isn't correct
23 Incorrect 131 ms 1516 KB Output isn't correct
24 Incorrect 138 ms 1516 KB Output isn't correct
25 Incorrect 119 ms 1516 KB Output isn't correct
26 Incorrect 135 ms 1516 KB Output isn't correct
27 Incorrect 166 ms 1524 KB Output isn't correct
28 Incorrect 138 ms 1524 KB Output isn't correct
29 Incorrect 173 ms 1524 KB Output isn't correct
30 Incorrect 77 ms 1524 KB Output isn't correct
31 Incorrect 2 ms 1524 KB Output isn't correct
32 Incorrect 2 ms 1524 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 1524 KB Partially correct
2 Partially correct 2 ms 1524 KB Partially correct
3 Partially correct 2 ms 1524 KB Partially correct
4 Partially correct 2 ms 1524 KB Partially correct
5 Partially correct 2 ms 1524 KB Partially correct
6 Partially correct 2 ms 1524 KB Partially correct
7 Partially correct 2 ms 1524 KB Partially correct
8 Partially correct 2 ms 1524 KB Partially correct
9 Partially correct 2 ms 1524 KB Partially correct
10 Partially correct 3 ms 1524 KB Partially correct
11 Partially correct 5 ms 1524 KB Partially correct
12 Partially correct 5 ms 1524 KB Partially correct
13 Partially correct 5 ms 1524 KB Partially correct
14 Partially correct 4 ms 1524 KB Partially correct
15 Partially correct 3 ms 1524 KB Partially correct
16 Partially correct 32 ms 1524 KB Partially correct
17 Partially correct 35 ms 1524 KB Partially correct
18 Partially correct 31 ms 1524 KB Partially correct
19 Partially correct 32 ms 1524 KB Partially correct
20 Partially correct 20 ms 1524 KB Partially correct
21 Partially correct 178 ms 1524 KB Partially correct
22 Partially correct 133 ms 1524 KB Partially correct
23 Partially correct 124 ms 1524 KB Partially correct
24 Partially correct 135 ms 1532 KB Partially correct
25 Partially correct 118 ms 1532 KB Partially correct
26 Partially correct 139 ms 1532 KB Partially correct
27 Partially correct 130 ms 1532 KB Partially correct
28 Partially correct 146 ms 1532 KB Partially correct
29 Partially correct 132 ms 1532 KB Partially correct
30 Partially correct 79 ms 1532 KB Partially correct
31 Partially correct 3 ms 1532 KB Partially correct
32 Partially correct 2 ms 1532 KB Partially correct