# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1113717 |
2024-11-17T08:39:52 Z |
simona1230 |
Gap (APIO16_gap) |
C++17 |
|
1079 ms |
524288 KB |
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
/*int nn;
long long a[200001];
void MinMax(long long l,long long r,long long *mn,long long *mx)
{
*mn=-1;
for(int i=1;i<=nn;i++)
if(a[i]>=l)
{
*mn=a[i];
break;
}
*mx=-1;
for(int i=nn;i>=1;i--)
if(a[i]<=r)
{
*mx=a[i];
break;
}
}*/
long long n;
long long solve(long long l,long long r)
{
if(l==-1||l>r)return 0;
//cout<<l<<" "<<r<<" "<<ll<<" "<<rr<<endl;
long long ans=0;
long long len=r-l+1;
long long b=max(1LL*1,len/n);
long long last=-1;
for(long long i=l;i<=r;i+=b)
{
long long j=min(i+b-1,r);
long long mn=0,mx=0;
//cout<<i<<" "<<j<<endl;
MinMax(i,j,&mn,&mx);
if(mn==-1)continue;
if(last!=-1)ans=max(ans,mn-last);
last=mx;
ans=max(ans,solve(mn,mx));
}
return ans;
}
long long findGap(int t,int N)
{
n=N;
return solve(1,1e18);
}
/*int main()
{
long long d=0;
int x;
cin>>x>>nn;
for(int i=1;i<=nn;i++)
{
cin>>a[i];
if(i!=1)d=max(d,a[i]-a[i-1]);
}
long long answer=findGap(1,nn);
cout<<d<<" "<<answer<<endl;
}*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
521 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Runtime error |
598 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Runtime error |
554 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Runtime error |
581 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Runtime error |
535 ms |
524288 KB |
Execution killed with signal 9 |
6 |
Runtime error |
637 ms |
524288 KB |
Execution killed with signal 9 |
7 |
Runtime error |
645 ms |
524288 KB |
Execution killed with signal 9 |
8 |
Runtime error |
680 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Runtime error |
620 ms |
524288 KB |
Execution killed with signal 9 |
10 |
Runtime error |
665 ms |
524288 KB |
Execution killed with signal 9 |
11 |
Runtime error |
713 ms |
524288 KB |
Execution killed with signal 9 |
12 |
Runtime error |
749 ms |
524288 KB |
Execution killed with signal 9 |
13 |
Runtime error |
786 ms |
524288 KB |
Execution killed with signal 9 |
14 |
Runtime error |
776 ms |
524288 KB |
Execution killed with signal 9 |
15 |
Runtime error |
799 ms |
524288 KB |
Execution killed with signal 9 |
16 |
Runtime error |
907 ms |
524288 KB |
Execution killed with signal 9 |
17 |
Runtime error |
867 ms |
524288 KB |
Execution killed with signal 9 |
18 |
Runtime error |
915 ms |
524288 KB |
Execution killed with signal 9 |
19 |
Runtime error |
949 ms |
524288 KB |
Execution killed with signal 9 |
20 |
Runtime error |
892 ms |
524288 KB |
Execution killed with signal 9 |
21 |
Runtime error |
1018 ms |
524288 KB |
Execution killed with signal 9 |
22 |
Runtime error |
1052 ms |
524288 KB |
Execution killed with signal 9 |
23 |
Runtime error |
1008 ms |
524288 KB |
Execution killed with signal 9 |
24 |
Runtime error |
1004 ms |
524288 KB |
Execution killed with signal 9 |
25 |
Runtime error |
1008 ms |
524288 KB |
Execution killed with signal 9 |
26 |
Runtime error |
1073 ms |
524288 KB |
Execution killed with signal 9 |
27 |
Runtime error |
1000 ms |
524288 KB |
Execution killed with signal 9 |
28 |
Runtime error |
955 ms |
524288 KB |
Execution killed with signal 9 |
29 |
Runtime error |
998 ms |
524288 KB |
Execution killed with signal 9 |
30 |
Runtime error |
1079 ms |
524288 KB |
Execution killed with signal 9 |
31 |
Runtime error |
650 ms |
524288 KB |
Execution killed with signal 9 |
32 |
Runtime error |
638 ms |
524288 KB |
Execution killed with signal 9 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
518 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Runtime error |
535 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Runtime error |
537 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Runtime error |
546 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Runtime error |
502 ms |
524288 KB |
Execution killed with signal 9 |
6 |
Runtime error |
627 ms |
524288 KB |
Execution killed with signal 9 |
7 |
Runtime error |
636 ms |
524288 KB |
Execution killed with signal 9 |
8 |
Runtime error |
622 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Runtime error |
640 ms |
524288 KB |
Execution killed with signal 9 |
10 |
Runtime error |
632 ms |
524288 KB |
Execution killed with signal 9 |
11 |
Runtime error |
741 ms |
524288 KB |
Execution killed with signal 9 |
12 |
Runtime error |
740 ms |
524288 KB |
Execution killed with signal 9 |
13 |
Runtime error |
698 ms |
524288 KB |
Execution killed with signal 9 |
14 |
Runtime error |
731 ms |
524288 KB |
Execution killed with signal 9 |
15 |
Runtime error |
770 ms |
524288 KB |
Execution killed with signal 9 |
16 |
Runtime error |
908 ms |
524288 KB |
Execution killed with signal 9 |
17 |
Runtime error |
917 ms |
524288 KB |
Execution killed with signal 9 |
18 |
Runtime error |
918 ms |
524288 KB |
Execution killed with signal 9 |
19 |
Runtime error |
954 ms |
524288 KB |
Execution killed with signal 9 |
20 |
Runtime error |
917 ms |
524288 KB |
Execution killed with signal 9 |
21 |
Runtime error |
1016 ms |
524288 KB |
Execution killed with signal 9 |
22 |
Runtime error |
1051 ms |
524288 KB |
Execution killed with signal 9 |
23 |
Runtime error |
1008 ms |
524288 KB |
Execution killed with signal 9 |
24 |
Runtime error |
1016 ms |
524288 KB |
Execution killed with signal 9 |
25 |
Runtime error |
961 ms |
524288 KB |
Execution killed with signal 9 |
26 |
Runtime error |
937 ms |
524288 KB |
Execution killed with signal 9 |
27 |
Runtime error |
1054 ms |
524288 KB |
Execution killed with signal 9 |
28 |
Runtime error |
988 ms |
524288 KB |
Execution killed with signal 9 |
29 |
Runtime error |
1012 ms |
524288 KB |
Execution killed with signal 9 |
30 |
Runtime error |
990 ms |
524288 KB |
Execution killed with signal 9 |
31 |
Runtime error |
632 ms |
524288 KB |
Execution killed with signal 9 |
32 |
Runtime error |
636 ms |
524288 KB |
Execution killed with signal 9 |