Submission #1113719

# Submission time Handle Problem Language Result Execution time Memory
1113719 2024-11-17T08:43:42 Z simona1230 Gap (APIO16_gap) C++17
0 / 100
2000 ms 3032 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||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(0,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 Incorrect 1 ms 336 KB Output isn't correct
2 Incorrect 1 ms 2552 KB Output isn't correct
3 Incorrect 1 ms 2384 KB Output isn't correct
4 Incorrect 1 ms 2384 KB Output isn't correct
5 Incorrect 1 ms 2384 KB Output isn't correct
6 Incorrect 1 ms 2384 KB Output isn't correct
7 Incorrect 1 ms 2384 KB Output isn't correct
8 Incorrect 1 ms 2384 KB Output isn't correct
9 Incorrect 1 ms 2384 KB Output isn't correct
10 Incorrect 1 ms 2384 KB Output isn't correct
11 Incorrect 38 ms 2496 KB Output isn't correct
12 Incorrect 39 ms 2384 KB Output isn't correct
13 Incorrect 42 ms 2384 KB Output isn't correct
14 Incorrect 38 ms 2384 KB Output isn't correct
15 Incorrect 2 ms 2384 KB Output isn't correct
16 Execution timed out 3065 ms 2384 KB Time limit exceeded
17 Execution timed out 3066 ms 2384 KB Time limit exceeded
18 Execution timed out 3048 ms 2384 KB Time limit exceeded
19 Execution timed out 3050 ms 2384 KB Time limit exceeded
20 Incorrect 15 ms 2384 KB Output isn't correct
21 Execution timed out 3067 ms 2640 KB Time limit exceeded
22 Execution timed out 3046 ms 2640 KB Time limit exceeded
23 Execution timed out 3070 ms 2640 KB Time limit exceeded
24 Execution timed out 3063 ms 2640 KB Time limit exceeded
25 Incorrect 54 ms 2640 KB Output isn't correct
26 Execution timed out 3063 ms 2640 KB Time limit exceeded
27 Execution timed out 3056 ms 2640 KB Time limit exceeded
28 Execution timed out 3066 ms 2640 KB Time limit exceeded
29 Execution timed out 3058 ms 2640 KB Time limit exceeded
30 Incorrect 64 ms 2640 KB Output isn't correct
31 Incorrect 1 ms 2384 KB Output isn't correct
32 Incorrect 1 ms 2384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2552 KB Output is correct
2 Partially correct 1 ms 2384 KB Partially correct
3 Partially correct 1 ms 2384 KB Partially correct
4 Partially correct 1 ms 2496 KB Partially correct
5 Partially correct 1 ms 2384 KB Partially correct
6 Partially correct 1 ms 2384 KB Partially correct
7 Partially correct 1 ms 2384 KB Partially correct
8 Partially correct 1 ms 2384 KB Partially correct
9 Partially correct 1 ms 2384 KB Partially correct
10 Partially correct 1 ms 2384 KB Partially correct
11 Partially correct 38 ms 2384 KB Partially correct
12 Partially correct 39 ms 2384 KB Partially correct
13 Partially correct 37 ms 2384 KB Partially correct
14 Partially correct 41 ms 2384 KB Partially correct
15 Partially correct 1 ms 2384 KB Partially correct
16 Execution timed out 3086 ms 2384 KB Time limit exceeded
17 Execution timed out 3047 ms 2384 KB Time limit exceeded
18 Execution timed out 3071 ms 2384 KB Time limit exceeded
19 Execution timed out 3058 ms 2384 KB Time limit exceeded
20 Partially correct 15 ms 2384 KB Partially correct
21 Execution timed out 3059 ms 2720 KB Time limit exceeded
22 Execution timed out 3066 ms 2856 KB Time limit exceeded
23 Execution timed out 3049 ms 2640 KB Time limit exceeded
24 Execution timed out 3065 ms 2640 KB Time limit exceeded
25 Partially correct 49 ms 2640 KB Partially correct
26 Execution timed out 3063 ms 2712 KB Time limit exceeded
27 Execution timed out 3051 ms 3032 KB Time limit exceeded
28 Execution timed out 3050 ms 2640 KB Time limit exceeded
29 Execution timed out 3033 ms 2640 KB Time limit exceeded
30 Partially correct 57 ms 2640 KB Partially correct
31 Partially correct 1 ms 2384 KB Partially correct
32 Partially correct 1 ms 2384 KB Partially correct