# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
560955 |
2022-05-12T05:43:23 Z |
karrigan |
Gap (APIO16_gap) |
C++14 |
|
55 ms |
1832 KB |
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#include "gap.h"
using namespace std;
const int maxn=1e6;
using ll=long long int;
long long a[100009];
long long findGap(int t, int n){
if (t==1){
a[0]=-1;
a[n+1]=2e18;
for (int i=1,j=n;i<=j;i++,j--){
MinMax(a[i-1]+1, a[j+1]-1, &a[i], &a[j]);
}
long long ans=-1;
for (int i=2;i<=n;i++){
ans=max(ans,a[i]-a[i-1]);
}
return ans;
}
else {
MinMax(0,1e18,&a[1],&a[n]);
long long temp=(a[n]-a[1])/(n-1);
if (n==2)return a[n]-a[1];
long long r=-1;
long long ans=-1;
for (long long ret=a[1];ret<a[n];ret+=temp+1){
long long mn,mx;
MinMax(ret,ret+temp,&mn,&mx);
if (mn==-1)continue;
if (r!=-1)ans=max(ans,mn-r);
if (mx!=-1)r=mx;
}
return ans;
}
}
# |
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 |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 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 |
10 ms |
592 KB |
Output is correct |
17 |
Correct |
9 ms |
592 KB |
Output is correct |
18 |
Correct |
10 ms |
592 KB |
Output is correct |
19 |
Correct |
9 ms |
604 KB |
Output is correct |
20 |
Correct |
10 ms |
828 KB |
Output is correct |
21 |
Correct |
36 ms |
1828 KB |
Output is correct |
22 |
Correct |
39 ms |
1784 KB |
Output is correct |
23 |
Correct |
42 ms |
1804 KB |
Output is correct |
24 |
Correct |
41 ms |
1796 KB |
Output is correct |
25 |
Correct |
32 ms |
1828 KB |
Output is correct |
26 |
Correct |
38 ms |
1828 KB |
Output is correct |
27 |
Correct |
39 ms |
1832 KB |
Output is correct |
28 |
Correct |
44 ms |
1760 KB |
Output is correct |
29 |
Correct |
36 ms |
1828 KB |
Output is correct |
30 |
Correct |
33 ms |
1776 KB |
Output is correct |
31 |
Correct |
0 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 |
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 |
13 ms |
528 KB |
Output is correct |
17 |
Correct |
14 ms |
464 KB |
Output is correct |
18 |
Correct |
15 ms |
464 KB |
Output is correct |
19 |
Correct |
13 ms |
512 KB |
Output is correct |
20 |
Correct |
7 ms |
524 KB |
Output is correct |
21 |
Correct |
53 ms |
1196 KB |
Output is correct |
22 |
Correct |
50 ms |
1084 KB |
Output is correct |
23 |
Correct |
52 ms |
1088 KB |
Output is correct |
24 |
Correct |
54 ms |
1064 KB |
Output is correct |
25 |
Correct |
50 ms |
1112 KB |
Output is correct |
26 |
Correct |
55 ms |
1060 KB |
Output is correct |
27 |
Correct |
51 ms |
1088 KB |
Output is correct |
28 |
Correct |
51 ms |
1092 KB |
Output is correct |
29 |
Correct |
54 ms |
1060 KB |
Output is correct |
30 |
Correct |
29 ms |
1032 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
0 ms |
208 KB |
Output is correct |