# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
667344 |
2022-12-01T07:28:21 Z |
NothingXD |
Gap (APIO16_gap) |
C++14 |
|
56 ms |
1916 KB |
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
/*typedef __uint128_t L;
struct FastMod {
ull b, m;
FastMod(ull b) : b(b), m(ull((L(1) << 64) / b)) {}
ull reduce(ull a) {
ull q = (ull)((L(m) * a) >> 64);
ull r = a - q * b; // can be proven that 0 <= r < 2*b
return r >= b ? r - b : r;
}
};
FastMod FM(2);*/
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
cerr << " " << H;
debug_out(T...);
}
#define debug(...) cerr << "(" << #__VA_ARGS__ << "):", debug_out(__VA_ARGS__)
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)
#define F first
#define S second
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int maxn = 1e5 + 10;
ll a[maxn];
ll solve(int n){
ll L = 0, R = 1e18;
for (int i = 1; 2 * i <= n+1; i++){
MinMax(L, R, &a[i], &a[n-i+1]);
L = a[i] + 1;
R = a[n-i+1] - 1;
}
ll ans = a[2] - a[1];
for (int i = 2; i <= n; i++){
ans = max(ans, a[i] - a[i-1]);
}
return ans;
}
long long findGap(int T, int N)
{
if (T == 1){
return solve(N);
}
ll L, R; MinMax(0, 1e18, &L, &R);
ll ans = (R - L + N - 2) / (N-1);
ll k = ans;
ll ptr = L + 1;
ll lst = L;
for (int i = 1; i < N; i++){
ll mn, mx; MinMax(ptr, ptr + k - 1, &mn, &mx);
if (mn != -1){
ans = max(ans, mn - lst);
lst = mx;
}
ptr += k;
}
return ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
9 ms |
648 KB |
Output is correct |
17 |
Correct |
9 ms |
632 KB |
Output is correct |
18 |
Correct |
9 ms |
592 KB |
Output is correct |
19 |
Correct |
9 ms |
688 KB |
Output is correct |
20 |
Correct |
7 ms |
592 KB |
Output is correct |
21 |
Correct |
38 ms |
1768 KB |
Output is correct |
22 |
Correct |
35 ms |
1772 KB |
Output is correct |
23 |
Correct |
46 ms |
1740 KB |
Output is correct |
24 |
Correct |
40 ms |
1860 KB |
Output is correct |
25 |
Correct |
31 ms |
1916 KB |
Output is correct |
26 |
Correct |
36 ms |
1816 KB |
Output is correct |
27 |
Correct |
43 ms |
1772 KB |
Output is correct |
28 |
Correct |
42 ms |
1824 KB |
Output is correct |
29 |
Correct |
42 ms |
1740 KB |
Output is correct |
30 |
Correct |
30 ms |
1736 KB |
Output is correct |
31 |
Correct |
1 ms |
208 KB |
Output is correct |
32 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Correct |
2 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
13 ms |
512 KB |
Output is correct |
17 |
Correct |
13 ms |
520 KB |
Output is correct |
18 |
Correct |
13 ms |
524 KB |
Output is correct |
19 |
Correct |
13 ms |
512 KB |
Output is correct |
20 |
Correct |
7 ms |
520 KB |
Output is correct |
21 |
Correct |
49 ms |
1188 KB |
Output is correct |
22 |
Correct |
52 ms |
1084 KB |
Output is correct |
23 |
Correct |
50 ms |
1088 KB |
Output is correct |
24 |
Correct |
56 ms |
1016 KB |
Output is correct |
25 |
Correct |
45 ms |
996 KB |
Output is correct |
26 |
Correct |
49 ms |
976 KB |
Output is correct |
27 |
Correct |
51 ms |
1088 KB |
Output is correct |
28 |
Correct |
51 ms |
968 KB |
Output is correct |
29 |
Correct |
49 ms |
1088 KB |
Output is correct |
30 |
Correct |
33 ms |
976 KB |
Output is correct |
31 |
Correct |
1 ms |
208 KB |
Output is correct |
32 |
Correct |
0 ms |
208 KB |
Output is correct |