# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1090718 |
2024-09-18T15:54:03 Z |
lovrot |
Gap (APIO16_gap) |
C++17 |
|
54 ms |
13964 KB |
#include "gap.h"
#include <cstdio>
#include <algorithm>
#define X first
#define Y second
#define PB push_back
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll OO = 1e18;
int cnt = 0;
pll query(ll a, ll b) {
if(a > b) { return {-1, -1}; }
ll ret, ret_;
++cnt;
MinMax(a, b, &ret, &ret_);
return {ret, ret_};
}
ll solve(ll lst, ll l, ll r, int n) {
if(n == 1) { return 0; }
pll res = query(l, l + (r - l) / (n - 1));
ll ret = res.X - lst;
pll res2 = query(res.X + 1, res.Y - 1);
// printf("%lld %lld %lld %d : %lld %lld %lld %lld\n", lst, l, r, n, res.X, res.Y, res2.X, res2.Y);
if(res2.X == -1) {
ret = max(ret, res.Y - res.X);
}
return ret = max(ret, solve(max(lst, res.Y), l + (r - l) / (n - 1) + 1, r, n - 1));
}
ll findGap(int T, int n) {
cnt = 0;
pll res = query(0, OO);
ll ret = solve(res.X, res.X, res.Y, n);
// if(cnt > 3 * n) { return -1; }
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
16 |
Incorrect |
12 ms |
3480 KB |
Output isn't correct |
17 |
Incorrect |
11 ms |
3672 KB |
Output isn't correct |
18 |
Incorrect |
11 ms |
3616 KB |
Output isn't correct |
19 |
Incorrect |
11 ms |
3672 KB |
Output isn't correct |
20 |
Incorrect |
6 ms |
3672 KB |
Output isn't correct |
21 |
Incorrect |
51 ms |
13468 KB |
Output isn't correct |
22 |
Incorrect |
50 ms |
13648 KB |
Output isn't correct |
23 |
Incorrect |
47 ms |
13648 KB |
Output isn't correct |
24 |
Incorrect |
47 ms |
13680 KB |
Output isn't correct |
25 |
Incorrect |
40 ms |
13656 KB |
Output isn't correct |
26 |
Incorrect |
46 ms |
13588 KB |
Output isn't correct |
27 |
Incorrect |
47 ms |
13652 KB |
Output isn't correct |
28 |
Incorrect |
48 ms |
13648 KB |
Output isn't correct |
29 |
Incorrect |
54 ms |
13648 KB |
Output isn't correct |
30 |
Incorrect |
32 ms |
13648 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
Partially correct |
2 |
Partially correct |
0 ms |
596 KB |
Partially correct |
3 |
Partially correct |
0 ms |
344 KB |
Partially correct |
4 |
Partially correct |
0 ms |
348 KB |
Partially correct |
5 |
Partially correct |
0 ms |
348 KB |
Partially correct |
6 |
Partially correct |
0 ms |
348 KB |
Partially correct |
7 |
Partially correct |
0 ms |
344 KB |
Partially correct |
8 |
Partially correct |
0 ms |
344 KB |
Partially correct |
9 |
Partially correct |
0 ms |
352 KB |
Partially correct |
10 |
Partially correct |
0 ms |
344 KB |
Partially correct |
11 |
Partially correct |
1 ms |
600 KB |
Partially correct |
12 |
Partially correct |
1 ms |
600 KB |
Partially correct |
13 |
Partially correct |
1 ms |
600 KB |
Partially correct |
14 |
Partially correct |
1 ms |
600 KB |
Partially correct |
15 |
Partially correct |
1 ms |
600 KB |
Partially correct |
16 |
Partially correct |
12 ms |
3672 KB |
Partially correct |
17 |
Partially correct |
11 ms |
3560 KB |
Partially correct |
18 |
Partially correct |
11 ms |
3748 KB |
Partially correct |
19 |
Partially correct |
10 ms |
3672 KB |
Partially correct |
20 |
Partially correct |
6 ms |
3672 KB |
Partially correct |
21 |
Partially correct |
46 ms |
13600 KB |
Partially correct |
22 |
Partially correct |
49 ms |
13488 KB |
Partially correct |
23 |
Partially correct |
45 ms |
13648 KB |
Partially correct |
24 |
Partially correct |
45 ms |
13580 KB |
Partially correct |
25 |
Partially correct |
44 ms |
13648 KB |
Partially correct |
26 |
Partially correct |
48 ms |
13652 KB |
Partially correct |
27 |
Partially correct |
46 ms |
13496 KB |
Partially correct |
28 |
Partially correct |
46 ms |
13704 KB |
Partially correct |
29 |
Partially correct |
45 ms |
13464 KB |
Partially correct |
30 |
Partially correct |
31 ms |
13964 KB |
Partially correct |
31 |
Partially correct |
0 ms |
344 KB |
Partially correct |
32 |
Partially correct |
0 ms |
344 KB |
Partially correct |