Submission #82263

# Submission time Handle Problem Language Result Execution time Memory
82263 2018-10-29T16:58:23 Z Bodo171 Gap (APIO16_gap) C++14
30 / 100
84 ms 2284 KB
#include "gap.h"
#include <iostream>
#include <climits>
using namespace std;
const int nmax=100005;
long long v[nmax];
long long mx,st,dr,act,len,oldlen,inf,sup,i;
int n;
long long findGap(int T, int N)
{
    n=N;
    if(T==1)
    {
        mx=0;
        v[0]=-1;v[n+1]=1LL*1e18;
        v[n+1]++;//don't mess with 1e18
        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=1LL*max(mx,1LL*v[i+1]-v[i]);
        return mx;
    }
    act=-1;len=1;oldlen=1;
    bool bun=1;
    long long mare=1LL*1e18;
    MinMax(0,mare,&inf,&sup);
    long long nn=n,ans=0;
    long long def=1LL*(sup-inf)/(nn-1);
    if((sup-inf)%(nn-1))
        def+=1LL;
    act=inf;
    for(long long i=1;i<=n-1;i++)
    {
        bool ok=1;
        while(ok)
        {
            ok=0;
            MinMax(act+1,min(act+1LL*i*def,mare),&st,&dr);
            if(dr!=-1)
            {
                ans=max(1LL*st-act,ans);
                act=dr;
                ok=1;
            }
        }
    }
	return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:30:10: warning: unused variable 'bun' [-Wunused-variable]
     bool bun=1;
          ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 472 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 2 ms 516 KB Output is correct
7 Correct 2 ms 516 KB Output is correct
8 Correct 2 ms 532 KB Output is correct
9 Correct 2 ms 532 KB Output is correct
10 Correct 2 ms 532 KB Output is correct
11 Correct 3 ms 532 KB Output is correct
12 Correct 3 ms 532 KB Output is correct
13 Correct 3 ms 532 KB Output is correct
14 Correct 4 ms 532 KB Output is correct
15 Correct 2 ms 532 KB Output is correct
16 Correct 15 ms 916 KB Output is correct
17 Correct 14 ms 916 KB Output is correct
18 Correct 15 ms 916 KB Output is correct
19 Correct 21 ms 976 KB Output is correct
20 Correct 11 ms 976 KB Output is correct
21 Correct 62 ms 2256 KB Output is correct
22 Correct 80 ms 2256 KB Output is correct
23 Correct 56 ms 2256 KB Output is correct
24 Correct 55 ms 2256 KB Output is correct
25 Correct 46 ms 2256 KB Output is correct
26 Correct 53 ms 2256 KB Output is correct
27 Correct 70 ms 2284 KB Output is correct
28 Correct 54 ms 2284 KB Output is correct
29 Correct 54 ms 2284 KB Output is correct
30 Correct 39 ms 2284 KB Output is correct
31 Correct 2 ms 2284 KB Output is correct
32 Correct 2 ms 2284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2284 KB Output is correct
2 Partially correct 2 ms 2284 KB Partially correct
3 Incorrect 2 ms 2284 KB Output isn't correct
4 Partially correct 2 ms 2284 KB Partially correct
5 Partially correct 2 ms 2284 KB Partially correct
6 Partially correct 2 ms 2284 KB Partially correct
7 Partially correct 2 ms 2284 KB Partially correct
8 Partially correct 2 ms 2284 KB Partially correct
9 Partially correct 2 ms 2284 KB Partially correct
10 Partially correct 2 ms 2284 KB Partially correct
11 Partially correct 3 ms 2284 KB Partially correct
12 Partially correct 3 ms 2284 KB Partially correct
13 Partially correct 3 ms 2284 KB Partially correct
14 Partially correct 3 ms 2284 KB Partially correct
15 Partially correct 4 ms 2284 KB Partially correct
16 Partially correct 16 ms 2284 KB Partially correct
17 Partially correct 15 ms 2284 KB Partially correct
18 Partially correct 15 ms 2284 KB Partially correct
19 Partially correct 15 ms 2284 KB Partially correct
20 Partially correct 10 ms 2284 KB Partially correct
21 Partially correct 55 ms 2284 KB Partially correct
22 Partially correct 58 ms 2284 KB Partially correct
23 Partially correct 55 ms 2284 KB Partially correct
24 Partially correct 55 ms 2284 KB Partially correct
25 Partially correct 84 ms 2284 KB Partially correct
26 Partially correct 56 ms 2284 KB Partially correct
27 Partially correct 82 ms 2284 KB Partially correct
28 Partially correct 59 ms 2284 KB Partially correct
29 Partially correct 55 ms 2284 KB Partially correct
30 Partially correct 63 ms 2284 KB Partially correct
31 Runtime error 2 ms 2284 KB Execution failed because the return code was nonzero
32 Runtime error 2 ms 2284 KB Execution failed because the return code was nonzero