# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
330821 |
2020-11-26T16:26:22 Z |
Sho10 |
Gap (APIO16_gap) |
C++14 |
|
65 ms |
2124 KB |
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long
#include "gap.h"
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod (10*10*10*10*10*10*10*10*10+7)
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll v[100005];
int findGap(int t,int n){
if(t==1){
ll l=1,r=n,a=0,b=1e18;
while(l<=r){
MinMax(a,b,&a,&b);
v[l++]=a++;
v[r--]=b--;
}
ll ans=0;
for(ll i=2;i<=n;i++)
{
ans=max(ans,v[i]-v[i-1]);
}
return ans;
}else {
ll a,b,ans=0;
MinMax(0,1e18,&a,&b);
if(b-a+1==n){
return 1;
}
ll nr=(b-a-1)/(n-1);
ll last=a;
ll x,y;
for(ll i=a+1;i<=b-1;i+=nr+1){
MinMax(i,i+nr,&x,&y);
if(x!=-1){
ans=max(ans,x-last);
}
if(y!=-1){
last=y;
}
}
return max(ans,b-last);
}
}
/*
int32_t main(){
CODE_START;
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
492 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
1 ms |
364 KB |
Output is correct |
13 |
Correct |
2 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
11 ms |
748 KB |
Output is correct |
17 |
Correct |
13 ms |
868 KB |
Output is correct |
18 |
Correct |
12 ms |
680 KB |
Output is correct |
19 |
Correct |
12 ms |
748 KB |
Output is correct |
20 |
Correct |
9 ms |
748 KB |
Output is correct |
21 |
Correct |
48 ms |
2028 KB |
Output is correct |
22 |
Correct |
54 ms |
2104 KB |
Output is correct |
23 |
Correct |
44 ms |
2028 KB |
Output is correct |
24 |
Correct |
48 ms |
1900 KB |
Output is correct |
25 |
Correct |
37 ms |
2124 KB |
Output is correct |
26 |
Correct |
43 ms |
1900 KB |
Output is correct |
27 |
Correct |
44 ms |
1900 KB |
Output is correct |
28 |
Correct |
44 ms |
1900 KB |
Output is correct |
29 |
Correct |
47 ms |
1900 KB |
Output is correct |
30 |
Correct |
35 ms |
1900 KB |
Output is correct |
31 |
Correct |
0 ms |
364 KB |
Output is correct |
32 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
0 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
0 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
0 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
1 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
14 ms |
492 KB |
Output is correct |
17 |
Correct |
15 ms |
492 KB |
Output is correct |
18 |
Correct |
14 ms |
492 KB |
Output is correct |
19 |
Correct |
15 ms |
580 KB |
Output is correct |
20 |
Correct |
7 ms |
492 KB |
Output is correct |
21 |
Correct |
65 ms |
1260 KB |
Output is correct |
22 |
Correct |
61 ms |
1132 KB |
Output is correct |
23 |
Correct |
58 ms |
1260 KB |
Output is correct |
24 |
Correct |
59 ms |
1132 KB |
Output is correct |
25 |
Correct |
55 ms |
1240 KB |
Output is correct |
26 |
Correct |
60 ms |
1260 KB |
Output is correct |
27 |
Correct |
64 ms |
1280 KB |
Output is correct |
28 |
Correct |
59 ms |
1132 KB |
Output is correct |
29 |
Correct |
59 ms |
1260 KB |
Output is correct |
30 |
Correct |
34 ms |
1132 KB |
Output is correct |
31 |
Correct |
1 ms |
364 KB |
Output is correct |
32 |
Correct |
1 ms |
364 KB |
Output is correct |