Submission #81908

# Submission time Handle Problem Language Result Execution time Memory
81908 2018-10-27T16:58:33 Z Bodo171 Gap (APIO16_gap) C++14
12.6461 / 100
71 ms 1660 KB
#include "gap.h"
#include <iostream>
using namespace std;
const int nmax=10005;
long long v[nmax];
long long mx,st,dr,act,len,oldlen,inf,sup;
int n,i;
long long findGap(int T, int N)
{
    n=N;
    if(T==1)
    {
        mx=0;
        v[0]=-1;v[n+1]=1LL*1e18+1;
        for(i=1;i<=(n+1)/2;i++)
        {
            MinMax(v[i-1]+1,v[n-i+2]-1,&v[i],&v[n-i+1]);
        }
        for(i=1;i<n;i++)
            mx=max(mx,v[i+1]-v[i]);
        return mx;
    }
    act=-1;len=1;oldlen=1;
    bool bun=1;
    MinMax(0,1LL*1e18,&inf,&sup);
    act=inf;
    for(i=1;i<=n&&bun==1;i++)
    {
        bool ok=0;
        if(act!=-1)oldlen=len;
        for(len;act+len/2<=sup&&ok==0;len*=2)
        {
            MinMax(act+1,act+len,&st,&dr);
            if(st!=-1)
                ok=1;
        }
        if(!ok)
            bun=0;
        if(act!=-1)
        {
            len=max(st-act,oldlen);
            act=dr;
        }
    }
	return len;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:31:16: warning: statement has no effect [-Wunused-value]
         for(len;act+len/2<=sup&&ok==0;len*=2)
                ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 516 KB Output is correct
4 Correct 2 ms 516 KB Output is correct
5 Correct 2 ms 524 KB Output is correct
6 Correct 2 ms 524 KB Output is correct
7 Correct 2 ms 568 KB Output is correct
8 Correct 3 ms 580 KB Output is correct
9 Correct 2 ms 580 KB Output is correct
10 Correct 3 ms 580 KB Output is correct
11 Correct 4 ms 580 KB Output is correct
12 Correct 4 ms 596 KB Output is correct
13 Correct 3 ms 596 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 2 ms 636 KB Output is correct
16 Runtime error 14 ms 892 KB Execution failed because the return code was nonzero
17 Runtime error 20 ms 896 KB Execution failed because the return code was nonzero
18 Runtime error 16 ms 924 KB Execution failed because the return code was nonzero
19 Runtime error 14 ms 924 KB Execution failed because the return code was nonzero
20 Runtime error 10 ms 924 KB Execution failed because the return code was nonzero
21 Runtime error 55 ms 1548 KB Execution failed because the return code was nonzero
22 Runtime error 34 ms 1548 KB Execution failed because the return code was nonzero
23 Runtime error 35 ms 1548 KB Execution failed because the return code was nonzero
24 Runtime error 50 ms 1660 KB Execution failed because the return code was nonzero
25 Runtime error 28 ms 1660 KB Execution failed because the return code was nonzero
26 Runtime error 35 ms 1660 KB Execution failed because the return code was nonzero
27 Runtime error 35 ms 1660 KB Execution failed because the return code was nonzero
28 Runtime error 34 ms 1660 KB Execution failed because the return code was nonzero
29 Runtime error 34 ms 1660 KB Execution failed because the return code was nonzero
30 Runtime error 20 ms 1660 KB Execution failed because the return code was nonzero
31 Incorrect 2 ms 1660 KB Output isn't correct
32 Correct 2 ms 1660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 1660 KB Partially correct
2 Partially correct 2 ms 1660 KB Partially correct
3 Partially correct 2 ms 1660 KB Partially correct
4 Partially correct 2 ms 1660 KB Partially correct
5 Partially correct 2 ms 1660 KB Partially correct
6 Correct 3 ms 1660 KB Output is correct
7 Correct 2 ms 1660 KB Output is correct
8 Correct 2 ms 1660 KB Output is correct
9 Correct 2 ms 1660 KB Output is correct
10 Correct 2 ms 1660 KB Output is correct
11 Correct 2 ms 1660 KB Output is correct
12 Correct 2 ms 1660 KB Output is correct
13 Correct 2 ms 1660 KB Output is correct
14 Correct 2 ms 1660 KB Output is correct
15 Partially correct 3 ms 1660 KB Partially correct
16 Correct 11 ms 1660 KB Output is correct
17 Correct 11 ms 1660 KB Output is correct
18 Correct 10 ms 1660 KB Output is correct
19 Correct 11 ms 1660 KB Output is correct
20 Correct 9 ms 1660 KB Output is correct
21 Correct 35 ms 1660 KB Output is correct
22 Correct 59 ms 1660 KB Output is correct
23 Correct 36 ms 1660 KB Output is correct
24 Correct 37 ms 1660 KB Output is correct
25 Partially correct 71 ms 1660 KB Partially correct
26 Correct 37 ms 1660 KB Output is correct
27 Correct 36 ms 1660 KB Output is correct
28 Correct 40 ms 1660 KB Output is correct
29 Correct 55 ms 1660 KB Output is correct
30 Correct 30 ms 1660 KB Output is correct
31 Partially correct 2 ms 1660 KB Partially correct
32 Correct 2 ms 1660 KB Output is correct