# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
709307 |
2023-03-13T10:45:57 Z |
WonderfulWhale |
Gap (APIO16_gap) |
C++17 |
|
51 ms |
2640 KB |
#include<bits/stdc++.h>
#include"gap.h"
using namespace std;
#define int long long
#define pb push_back
#define st first
#define nd second
#define pii pair<int, int>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
long long findGap(int32_t t, int32_t n) {
if(t==1 || n<=10) {
vector<int> a;
vector<int> b;
int l = 0;
int r = 1e18;
for(int i=0;i<(n+1)/2;i++) {
int x, y;
MinMax(l, r, &x, &y);
a.pb(x);
b.pb(y);
l = x+1;
r = y-1;
}
reverse(all(b));
for(int x:b) a.pb(x);
int ans = 0;
for(int i=0;i<sz(a)-1;i++) {
ans = max(ans, a[i+1]-a[i]);
}
return ans;
}
int l, r;
MinMax(0, 1e18, &l, &r);
int A = (r-l)/n;
int cur = l;
int jump = A;
int ans = A;
int S = A;
while(cur!=r) {
int x, y;
MinMax(cur+1, cur+S, &x, &y);
if(x!=-1) {
ans = max(ans, x-cur);
cur = y;
S = 0;
} else {
ans = S;
}
jump = ans+1;
S += jump;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
1 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 |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
13 ms |
976 KB |
Output is correct |
17 |
Correct |
10 ms |
976 KB |
Output is correct |
18 |
Correct |
9 ms |
976 KB |
Output is correct |
19 |
Correct |
9 ms |
976 KB |
Output is correct |
20 |
Correct |
7 ms |
976 KB |
Output is correct |
21 |
Correct |
38 ms |
2620 KB |
Output is correct |
22 |
Correct |
51 ms |
2640 KB |
Output is correct |
23 |
Correct |
38 ms |
2576 KB |
Output is correct |
24 |
Correct |
35 ms |
2608 KB |
Output is correct |
25 |
Correct |
30 ms |
2540 KB |
Output is correct |
26 |
Correct |
45 ms |
2628 KB |
Output is correct |
27 |
Correct |
48 ms |
2572 KB |
Output is correct |
28 |
Correct |
34 ms |
2636 KB |
Output is correct |
29 |
Correct |
34 ms |
2632 KB |
Output is correct |
30 |
Correct |
29 ms |
2632 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
1 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 |
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 |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
208 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 |
208 KB |
Output is correct |
16 |
Correct |
6 ms |
464 KB |
Output is correct |
17 |
Correct |
6 ms |
552 KB |
Output is correct |
18 |
Correct |
6 ms |
464 KB |
Output is correct |
19 |
Correct |
7 ms |
464 KB |
Output is correct |
20 |
Correct |
3 ms |
464 KB |
Output is correct |
21 |
Correct |
29 ms |
1048 KB |
Output is correct |
22 |
Correct |
23 ms |
1184 KB |
Output is correct |
23 |
Correct |
22 ms |
1076 KB |
Output is correct |
24 |
Correct |
21 ms |
968 KB |
Output is correct |
25 |
Correct |
48 ms |
1060 KB |
Output is correct |
26 |
Correct |
24 ms |
1080 KB |
Output is correct |
27 |
Correct |
22 ms |
968 KB |
Output is correct |
28 |
Correct |
23 ms |
1048 KB |
Output is correct |
29 |
Correct |
24 ms |
1156 KB |
Output is correct |
30 |
Correct |
11 ms |
1064 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
0 ms |
208 KB |
Output is correct |