# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1015128 |
2024-07-06T06:30:26 Z |
vjudge1 |
Gap (APIO16_gap) |
C++17 |
|
312 ms |
2136 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
long long findGap(signed t,signed n)
{
if (t==2)
{
ll mn1,mx1,lim1=0,lim2=1e18,mn,mx;
MinMax(lim1,lim2,&mn1,&mx1);
ll s=0,e=1e18;
while (s+1<e)
{
ll mid = (s+e)/2, l = mn1;
bool b=0;
while (l+mid<mx1)
{
MinMax(l+1,l+mid,&mn,&mx);
if (mn==-1)
{
b=1;
break;
}
l=mx;
}
if (b)
s=mid;
else
e=mid;
}
return s+1;
}
else
{
long long a[n],i=0,j=n-1,lim1=0,lim2=1e18;
long long mn,mx;
while (i<=j)
{
MinMax(lim1,lim2,&mn,&mx);
a[i++]=mn;
a[j--]=mx;
lim1=mn+1;
lim2=mx-1;
}
long long ans=0;
for (int i=0;i<n-1;i++)
ans=max(ans,a[i+1]-a[i]);
return ans;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
424 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
7 ms |
600 KB |
Output is correct |
17 |
Correct |
7 ms |
844 KB |
Output is correct |
18 |
Correct |
6 ms |
600 KB |
Output is correct |
19 |
Correct |
8 ms |
724 KB |
Output is correct |
20 |
Correct |
5 ms |
600 KB |
Output is correct |
21 |
Correct |
26 ms |
1880 KB |
Output is correct |
22 |
Correct |
26 ms |
1892 KB |
Output is correct |
23 |
Correct |
27 ms |
1880 KB |
Output is correct |
24 |
Correct |
28 ms |
2136 KB |
Output is correct |
25 |
Correct |
24 ms |
1880 KB |
Output is correct |
26 |
Correct |
26 ms |
1880 KB |
Output is correct |
27 |
Correct |
26 ms |
1880 KB |
Output is correct |
28 |
Correct |
26 ms |
2024 KB |
Output is correct |
29 |
Correct |
26 ms |
1880 KB |
Output is correct |
30 |
Correct |
25 ms |
1880 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
Partially correct |
2 |
Partially correct |
0 ms |
344 KB |
Partially correct |
3 |
Partially correct |
0 ms |
344 KB |
Partially correct |
4 |
Partially correct |
0 ms |
344 KB |
Partially correct |
5 |
Partially correct |
0 ms |
344 KB |
Partially correct |
6 |
Partially correct |
1 ms |
344 KB |
Partially correct |
7 |
Partially correct |
0 ms |
344 KB |
Partially correct |
8 |
Partially correct |
0 ms |
340 KB |
Partially correct |
9 |
Partially correct |
0 ms |
344 KB |
Partially correct |
10 |
Partially correct |
0 ms |
344 KB |
Partially correct |
11 |
Partially correct |
2 ms |
344 KB |
Partially correct |
12 |
Partially correct |
2 ms |
344 KB |
Partially correct |
13 |
Partially correct |
2 ms |
344 KB |
Partially correct |
14 |
Partially correct |
2 ms |
344 KB |
Partially correct |
15 |
Partially correct |
4 ms |
344 KB |
Partially correct |
16 |
Partially correct |
55 ms |
636 KB |
Partially correct |
17 |
Partially correct |
38 ms |
600 KB |
Partially correct |
18 |
Partially correct |
39 ms |
600 KB |
Partially correct |
19 |
Partially correct |
39 ms |
848 KB |
Partially correct |
20 |
Partially correct |
2 ms |
600 KB |
Partially correct |
21 |
Partially correct |
171 ms |
1216 KB |
Partially correct |
22 |
Partially correct |
172 ms |
1364 KB |
Partially correct |
23 |
Partially correct |
186 ms |
1220 KB |
Partially correct |
24 |
Partially correct |
151 ms |
1112 KB |
Partially correct |
25 |
Partially correct |
312 ms |
1224 KB |
Partially correct |
26 |
Partially correct |
144 ms |
1212 KB |
Partially correct |
27 |
Partially correct |
192 ms |
1112 KB |
Partially correct |
28 |
Partially correct |
191 ms |
1116 KB |
Partially correct |
29 |
Partially correct |
170 ms |
1212 KB |
Partially correct |
30 |
Partially correct |
14 ms |
1112 KB |
Partially correct |
31 |
Partially correct |
1 ms |
344 KB |
Partially correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |