# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1091860 |
2024-09-22T11:18:54 Z |
lovrot |
Gap (APIO16_gap) |
C++17 |
|
49 ms |
9008 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));
return max(res.X - lst, 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 + 1, res.Y, n);
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
0 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 |
344 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
428 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
436 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
16 |
Incorrect |
13 ms |
2464 KB |
Output isn't correct |
17 |
Incorrect |
10 ms |
2392 KB |
Output isn't correct |
18 |
Incorrect |
11 ms |
2392 KB |
Output isn't correct |
19 |
Incorrect |
10 ms |
2392 KB |
Output isn't correct |
20 |
Incorrect |
6 ms |
2492 KB |
Output isn't correct |
21 |
Incorrect |
43 ms |
8784 KB |
Output isn't correct |
22 |
Incorrect |
42 ms |
9008 KB |
Output isn't correct |
23 |
Incorrect |
41 ms |
8784 KB |
Output isn't correct |
24 |
Incorrect |
43 ms |
8784 KB |
Output isn't correct |
25 |
Incorrect |
40 ms |
8784 KB |
Output isn't correct |
26 |
Incorrect |
39 ms |
8816 KB |
Output isn't correct |
27 |
Incorrect |
42 ms |
8792 KB |
Output isn't correct |
28 |
Incorrect |
42 ms |
8960 KB |
Output isn't correct |
29 |
Incorrect |
42 ms |
8784 KB |
Output isn't correct |
30 |
Incorrect |
29 ms |
8784 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 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
10 ms |
2392 KB |
Output is correct |
17 |
Correct |
10 ms |
2392 KB |
Output is correct |
18 |
Correct |
10 ms |
2392 KB |
Output is correct |
19 |
Correct |
9 ms |
2392 KB |
Output is correct |
20 |
Correct |
6 ms |
2428 KB |
Output is correct |
21 |
Correct |
42 ms |
8784 KB |
Output is correct |
22 |
Correct |
45 ms |
8784 KB |
Output is correct |
23 |
Correct |
40 ms |
8792 KB |
Output is correct |
24 |
Correct |
49 ms |
8924 KB |
Output is correct |
25 |
Correct |
47 ms |
8836 KB |
Output is correct |
26 |
Correct |
43 ms |
8792 KB |
Output is correct |
27 |
Correct |
42 ms |
8968 KB |
Output is correct |
28 |
Correct |
38 ms |
8784 KB |
Output is correct |
29 |
Correct |
39 ms |
8784 KB |
Output is correct |
30 |
Correct |
30 ms |
8792 KB |
Output is correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |