Submission #82275

# Submission time Handle Problem Language Result Execution time Memory
82275 2018-10-29T17:32:45 Z Bodo171 Gap (APIO16_gap) C++14
30 / 100
68 ms 10084 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,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;
    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=1LL*inf;ans=1LL*def;
    long long dr_vechi=inf;
    for(long long i=1;i<=n-1&&act+1LL*(i-1)*def<=sup;i++)
    {
            MinMax(act+1,act+1LL*i*def,&st,&dr);
            if(dr!=-1)
            {
                ans=1LL*max(1LL*st-dr_vechi,ans);
                dr_vechi=dr;
            }
    }//am schimbat ca poate nu e eval bun
	return ans;
}
# 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 432 KB Output is correct
4 Correct 2 ms 480 KB Output is correct
5 Correct 2 ms 488 KB Output is correct
6 Correct 2 ms 488 KB Output is correct
7 Correct 2 ms 620 KB Output is correct
8 Correct 2 ms 620 KB Output is correct
9 Correct 2 ms 620 KB Output is correct
10 Correct 2 ms 620 KB Output is correct
11 Correct 3 ms 620 KB Output is correct
12 Correct 3 ms 772 KB Output is correct
13 Correct 3 ms 772 KB Output is correct
14 Correct 3 ms 772 KB Output is correct
15 Correct 3 ms 772 KB Output is correct
16 Correct 15 ms 1152 KB Output is correct
17 Correct 16 ms 1192 KB Output is correct
18 Correct 15 ms 1192 KB Output is correct
19 Correct 15 ms 1192 KB Output is correct
20 Correct 11 ms 1192 KB Output is correct
21 Correct 68 ms 2372 KB Output is correct
22 Correct 56 ms 2372 KB Output is correct
23 Correct 55 ms 2372 KB Output is correct
24 Correct 56 ms 2372 KB Output is correct
25 Correct 46 ms 2372 KB Output is correct
26 Correct 56 ms 2372 KB Output is correct
27 Correct 64 ms 2384 KB Output is correct
28 Correct 58 ms 2384 KB Output is correct
29 Correct 64 ms 2384 KB Output is correct
30 Correct 55 ms 2384 KB Output is correct
31 Correct 3 ms 2384 KB Output is correct
32 Correct 3 ms 2384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2384 KB Output is correct
2 Incorrect 2 ms 2384 KB Output isn't correct
3 Incorrect 2 ms 2384 KB Output isn't correct
4 Incorrect 2 ms 2384 KB Output isn't correct
5 Partially correct 2 ms 2384 KB Partially correct
6 Incorrect 2 ms 2384 KB Output isn't correct
7 Incorrect 2 ms 2384 KB Output isn't correct
8 Incorrect 2 ms 2384 KB Output isn't correct
9 Incorrect 2 ms 2384 KB Output isn't correct
10 Incorrect 2 ms 2384 KB Output isn't correct
11 Incorrect 3 ms 2384 KB Output isn't correct
12 Incorrect 3 ms 2384 KB Output isn't correct
13 Incorrect 3 ms 2384 KB Output isn't correct
14 Incorrect 3 ms 2384 KB Output isn't correct
15 Partially correct 3 ms 2384 KB Partially correct
16 Incorrect 16 ms 2384 KB Output isn't correct
17 Incorrect 16 ms 2384 KB Output isn't correct
18 Incorrect 17 ms 2384 KB Output isn't correct
19 Incorrect 16 ms 2816 KB Output isn't correct
20 Incorrect 11 ms 2896 KB Output isn't correct
21 Incorrect 60 ms 5484 KB Expected int32, but "5259716898" found
22 Incorrect 60 ms 7228 KB Expected int32, but "5255522611" found
23 Incorrect 62 ms 9036 KB Expected int32, but "5268383601" found
24 Incorrect 61 ms 10084 KB Expected int32, but "5244376792" found
25 Incorrect 55 ms 10084 KB Expected int32, but "5000150000" found
26 Incorrect 60 ms 10084 KB Expected int32, but "5255031513" found
27 Incorrect 63 ms 10084 KB Expected int32, but "5246765709" found
28 Incorrect 62 ms 10084 KB Expected int32, but "5247960681" found
29 Incorrect 64 ms 10084 KB Expected int32, but "5257888612" found
30 Incorrect 37 ms 10084 KB Expected int32, but "4425285201" found
31 Incorrect 2 ms 10084 KB Output isn't correct
32 Partially correct 3 ms 10084 KB Partially correct