# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
272923 |
2020-08-18T19:56:59 Z |
cheissmart |
Gap (APIO16_gap) |
C++14 |
|
75 ms |
1984 KB |
#include "gap.h"
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define V vector
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;
long long findGap(int T, int N)
{
if(T == 1) {
int l = 1, r = N;
ll lb = 0, rb = 1e18;
V<ll> v(N + 1);
while(l <= r) {
ll mn, mx;
MinMax(lb, rb, &mn, &mx);
v[l] = mn, v[r] = mx;
l++, r--;
lb = mn+1, rb = mx-1;
}
ll ans = 0;
for(int i = 1; i < N; i++) ans = max(ans, v[i+1]-v[i]);
return ans;
} else {
ll s, t, ans = 0;
MinMax(0, 1e18, &s, &t);
ll p = (t - s + N - 1) / N;
ll pre = s;
for(ll i = s+1; i <= t; i+=p+1) {
ll mn, mx;
MinMax(i, i+p, &mn, &mx);
if(mn != -1) {
ans = max(ans, mn - pre);
pre = mx;
}
}
return ans;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
512 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
15 ms |
712 KB |
Output is correct |
17 |
Correct |
13 ms |
768 KB |
Output is correct |
18 |
Correct |
13 ms |
768 KB |
Output is correct |
19 |
Correct |
15 ms |
768 KB |
Output is correct |
20 |
Correct |
9 ms |
732 KB |
Output is correct |
21 |
Correct |
51 ms |
1892 KB |
Output is correct |
22 |
Correct |
52 ms |
1912 KB |
Output is correct |
23 |
Correct |
53 ms |
1912 KB |
Output is correct |
24 |
Correct |
51 ms |
1912 KB |
Output is correct |
25 |
Correct |
43 ms |
1912 KB |
Output is correct |
26 |
Correct |
50 ms |
1968 KB |
Output is correct |
27 |
Correct |
52 ms |
1984 KB |
Output is correct |
28 |
Correct |
51 ms |
1912 KB |
Output is correct |
29 |
Correct |
54 ms |
1976 KB |
Output is correct |
30 |
Correct |
36 ms |
1912 KB |
Output is correct |
31 |
Correct |
0 ms |
384 KB |
Output is correct |
32 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
18 ms |
512 KB |
Output is correct |
17 |
Correct |
16 ms |
512 KB |
Output is correct |
18 |
Correct |
16 ms |
512 KB |
Output is correct |
19 |
Correct |
18 ms |
512 KB |
Output is correct |
20 |
Correct |
7 ms |
512 KB |
Output is correct |
21 |
Correct |
66 ms |
1144 KB |
Output is correct |
22 |
Correct |
66 ms |
1152 KB |
Output is correct |
23 |
Correct |
71 ms |
1144 KB |
Output is correct |
24 |
Correct |
66 ms |
1152 KB |
Output is correct |
25 |
Correct |
59 ms |
1144 KB |
Output is correct |
26 |
Correct |
75 ms |
1144 KB |
Output is correct |
27 |
Correct |
68 ms |
1072 KB |
Output is correct |
28 |
Correct |
67 ms |
1148 KB |
Output is correct |
29 |
Correct |
74 ms |
1088 KB |
Output is correct |
30 |
Correct |
33 ms |
1152 KB |
Output is correct |
31 |
Correct |
0 ms |
384 KB |
Output is correct |
32 |
Correct |
0 ms |
384 KB |
Output is correct |