Submission #82165

# Submission time Handle Problem Language Result Execution time Memory
82165 2018-10-29T10:40:05 Z Bodo171 Gap (APIO16_gap) C++14
0 / 100
79 ms 38992 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/2;i++)
        {
            MinMax(v[i-1]+1,v[n-i+2]-1,&v[i],&v[n-i+1]);
        }
        if((n&1))
        {
            MinMax(v[n/2]+1,v[n/2+2]-1,&v[(n+1)/2],&sup);
        }
        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);
    long long nn=n;
    long long def=(inf-sup)/nn;
    act=inf;
    for(i=1;i<=n;i++)
    {
        bool ok=0;
        if(act!=-1)oldlen=len;
        MinMax(act+1,act+1LL*i*len,&st,&dr);
        if(dr!=-1)
        {
            len=max(st-act,oldlen);
            act=dr;
        }
    }
	return len;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:35:14: warning: unused variable 'ok' [-Wunused-variable]
         bool ok=0;
              ^~
gap.cpp:28:10: warning: unused variable 'bun' [-Wunused-variable]
     bool bun=1;
          ^~~
gap.cpp:31:15: warning: unused variable 'def' [-Wunused-variable]
     long long def=(inf-sup)/nn;
               ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 476 KB Output is correct
3 Correct 2 ms 476 KB Output is correct
4 Correct 2 ms 628 KB Output is correct
5 Correct 2 ms 628 KB Output is correct
6 Correct 3 ms 628 KB Output is correct
7 Correct 2 ms 628 KB Output is correct
8 Correct 2 ms 748 KB Output is correct
9 Correct 2 ms 748 KB Output is correct
10 Correct 2 ms 784 KB Output is correct
11 Correct 3 ms 784 KB Output is correct
12 Correct 3 ms 784 KB Output is correct
13 Correct 3 ms 784 KB Output is correct
14 Correct 4 ms 784 KB Output is correct
15 Correct 4 ms 788 KB Output is correct
16 Runtime error 16 ms 1696 KB Execution failed because the return code was nonzero
17 Runtime error 14 ms 2136 KB Execution failed because the return code was nonzero
18 Runtime error 15 ms 2628 KB Execution failed because the return code was nonzero
19 Runtime error 15 ms 2964 KB Execution failed because the return code was nonzero
20 Runtime error 11 ms 3208 KB Execution failed because the return code was nonzero
21 Runtime error 36 ms 5504 KB Execution failed because the return code was nonzero
22 Runtime error 37 ms 7348 KB Execution failed because the return code was nonzero
23 Runtime error 35 ms 9192 KB Execution failed because the return code was nonzero
24 Runtime error 37 ms 11028 KB Execution failed because the return code was nonzero
25 Runtime error 32 ms 12360 KB Execution failed because the return code was nonzero
26 Runtime error 36 ms 14080 KB Execution failed because the return code was nonzero
27 Runtime error 37 ms 15916 KB Execution failed because the return code was nonzero
28 Runtime error 59 ms 17760 KB Execution failed because the return code was nonzero
29 Runtime error 35 ms 19604 KB Execution failed because the return code was nonzero
30 Runtime error 22 ms 20296 KB Execution failed because the return code was nonzero
31 Incorrect 3 ms 20296 KB Output isn't correct
32 Correct 3 ms 20296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 20296 KB Output isn't correct
2 Incorrect 2 ms 20296 KB Output isn't correct
3 Incorrect 2 ms 20296 KB Output isn't correct
4 Incorrect 2 ms 20296 KB Output isn't correct
5 Incorrect 2 ms 20296 KB Output isn't correct
6 Incorrect 2 ms 20296 KB Output isn't correct
7 Incorrect 3 ms 20296 KB Output isn't correct
8 Incorrect 2 ms 20296 KB Output isn't correct
9 Incorrect 2 ms 20296 KB Output isn't correct
10 Incorrect 2 ms 20296 KB Output isn't correct
11 Incorrect 3 ms 20296 KB Output isn't correct
12 Incorrect 3 ms 20296 KB Output isn't correct
13 Incorrect 3 ms 20296 KB Output isn't correct
14 Incorrect 3 ms 20296 KB Output isn't correct
15 Incorrect 3 ms 20296 KB Output isn't correct
16 Incorrect 14 ms 20296 KB Output isn't correct
17 Incorrect 16 ms 20716 KB Output isn't correct
18 Incorrect 17 ms 21180 KB Output isn't correct
19 Incorrect 15 ms 21648 KB Output isn't correct
20 Incorrect 11 ms 21724 KB Output isn't correct
21 Incorrect 79 ms 24184 KB Output isn't correct
22 Incorrect 57 ms 26000 KB Output isn't correct
23 Incorrect 53 ms 27888 KB Output isn't correct
24 Incorrect 52 ms 29708 KB Output isn't correct
25 Incorrect 41 ms 30912 KB Output isn't correct
26 Incorrect 48 ms 32768 KB Output isn't correct
27 Incorrect 69 ms 34612 KB Output isn't correct
28 Incorrect 51 ms 36460 KB Output isn't correct
29 Incorrect 74 ms 38428 KB Output isn't correct
30 Incorrect 39 ms 38992 KB Output isn't correct
31 Runtime error 2 ms 38992 KB Execution failed because the return code was nonzero
32 Incorrect 3 ms 38992 KB Output isn't correct