Submission #81907

# Submission time Handle Problem Language Result Execution time Memory
81907 2018-10-27T16:56:59 Z Bodo171 Gap (APIO16_gap) C++14
0 / 100
71 ms 17820 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<=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<=sup&&ok==0;len*=2)
                ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 440 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 2 ms 488 KB Output is correct
6 Correct 2 ms 492 KB Output is correct
7 Correct 2 ms 492 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 2 ms 552 KB Output is correct
11 Correct 3 ms 552 KB Output is correct
12 Correct 3 ms 552 KB Output is correct
13 Correct 3 ms 680 KB Output is correct
14 Correct 3 ms 680 KB Output is correct
15 Correct 3 ms 680 KB Output is correct
16 Runtime error 15 ms 1392 KB Execution failed because the return code was nonzero
17 Runtime error 16 ms 1984 KB Execution failed because the return code was nonzero
18 Runtime error 17 ms 2372 KB Execution failed because the return code was nonzero
19 Runtime error 14 ms 2788 KB Execution failed because the return code was nonzero
20 Runtime error 10 ms 2880 KB Execution failed because the return code was nonzero
21 Runtime error 35 ms 5392 KB Execution failed because the return code was nonzero
22 Runtime error 35 ms 7188 KB Execution failed because the return code was nonzero
23 Runtime error 34 ms 9024 KB Execution failed because the return code was nonzero
24 Runtime error 35 ms 10852 KB Execution failed because the return code was nonzero
25 Runtime error 29 ms 11936 KB Execution failed because the return code was nonzero
26 Runtime error 39 ms 13380 KB Execution failed because the return code was nonzero
27 Runtime error 34 ms 13444 KB Execution failed because the return code was nonzero
28 Runtime error 36 ms 13444 KB Execution failed because the return code was nonzero
29 Runtime error 35 ms 14864 KB Execution failed because the return code was nonzero
30 Runtime error 24 ms 15420 KB Execution failed because the return code was nonzero
31 Incorrect 2 ms 15420 KB Output isn't correct
32 Correct 2 ms 15420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 15420 KB Output isn't correct
2 Partially correct 2 ms 15420 KB Partially correct
3 Incorrect 2 ms 15420 KB Output isn't correct
4 Partially correct 3 ms 15420 KB Partially correct
5 Partially correct 2 ms 15420 KB Partially correct
6 Correct 2 ms 15420 KB Output is correct
7 Correct 2 ms 15420 KB Output is correct
8 Correct 2 ms 15420 KB Output is correct
9 Correct 2 ms 15420 KB Output is correct
10 Incorrect 2 ms 15420 KB Output isn't correct
11 Correct 3 ms 15420 KB Output is correct
12 Correct 3 ms 15420 KB Output is correct
13 Correct 3 ms 15420 KB Output is correct
14 Correct 3 ms 15420 KB Output is correct
15 Partially correct 4 ms 15420 KB Partially correct
16 Correct 12 ms 15428 KB Output is correct
17 Correct 16 ms 15988 KB Output is correct
18 Correct 16 ms 16356 KB Output is correct
19 Correct 11 ms 16820 KB Output is correct
20 Incorrect 11 ms 16900 KB Output isn't correct
21 Correct 36 ms 17696 KB Output is correct
22 Correct 36 ms 17696 KB Output is correct
23 Correct 35 ms 17696 KB Output is correct
24 Correct 35 ms 17696 KB Output is correct
25 Partially correct 71 ms 17820 KB Partially correct
26 Correct 37 ms 17820 KB Output is correct
27 Correct 37 ms 17820 KB Output is correct
28 Correct 38 ms 17820 KB Output is correct
29 Correct 36 ms 17820 KB Output is correct
30 Incorrect 32 ms 17820 KB Output isn't correct
31 Incorrect 2 ms 17820 KB Output isn't correct
32 Correct 2 ms 17820 KB Output is correct