Submission #106009

# Submission time Handle Problem Language Result Execution time Memory
106009 2019-04-16T07:48:52 Z daniel920712 Gap (APIO16_gap) C++14
12.8863 / 100
83 ms 2040 KB
#include <iostream>
#include <algorithm>
#include "gap.h"

using namespace std;
int now=0;
long long all[100005];
void F(long long l,long long r)
{
    long long a,b;
    if(l>r) return;
    MinMax(l,r,&a,&b);
    if(a==-1) return ;
    //printf("%lld %lld %lld %lld\n",l,r,a,b);
    all[now++]=a;
    if(a!=b) all[now++]=b;
    if(b-1<=(l+r)/2||(l+r)/2+1<=a+1) F(a+1,b-1);
    else
    {
        F(a+1,(l+r)/2);
        F((l+r)/2+1,b-1);
    }

}
bool cmp(long long a,long long b)
{
    return  a<b;
}
long long findGap(int T,int N)
{
    long long a,b,l=0,r=N-1,x=0,y=1000000000000000000 ,ans=0;
    int i;
    F(x,y);
    sort(all,all+N,cmp);
    for(i=1;i<N;i++) ans=max(ans,all[i]-all[i-1]);
    return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:31:15: warning: unused variable 'a' [-Wunused-variable]
     long long a,b,l=0,r=N-1,x=0,y=1000000000000000000 ,ans=0;
               ^
gap.cpp:31:17: warning: unused variable 'b' [-Wunused-variable]
     long long a,b,l=0,r=N-1,x=0,y=1000000000000000000 ,ans=0;
                 ^
gap.cpp:31:19: warning: unused variable 'l' [-Wunused-variable]
     long long a,b,l=0,r=N-1,x=0,y=1000000000000000000 ,ans=0;
                   ^
gap.cpp:31:23: warning: unused variable 'r' [-Wunused-variable]
     long long a,b,l=0,r=N-1,x=0,y=1000000000000000000 ,ans=0;
                       ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Incorrect 2 ms 384 KB Output isn't correct
5 Incorrect 2 ms 384 KB Output isn't correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Incorrect 2 ms 384 KB Output isn't correct
8 Incorrect 2 ms 384 KB Output isn't correct
9 Incorrect 3 ms 384 KB Output isn't correct
10 Incorrect 2 ms 384 KB Output isn't correct
11 Incorrect 3 ms 384 KB Output isn't correct
12 Incorrect 3 ms 384 KB Output isn't correct
13 Incorrect 4 ms 384 KB Output isn't correct
14 Incorrect 3 ms 384 KB Output isn't correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Incorrect 20 ms 760 KB Output isn't correct
17 Incorrect 23 ms 768 KB Output isn't correct
18 Incorrect 18 ms 768 KB Output isn't correct
19 Incorrect 18 ms 768 KB Output isn't correct
20 Incorrect 16 ms 768 KB Output isn't correct
21 Incorrect 76 ms 1912 KB Output isn't correct
22 Incorrect 81 ms 1912 KB Output isn't correct
23 Incorrect 70 ms 1912 KB Output isn't correct
24 Incorrect 79 ms 1912 KB Output isn't correct
25 Incorrect 55 ms 1912 KB Output isn't correct
26 Incorrect 66 ms 2012 KB Output isn't correct
27 Incorrect 83 ms 1916 KB Output isn't correct
28 Incorrect 81 ms 1884 KB Output isn't correct
29 Incorrect 69 ms 1912 KB Output isn't correct
30 Incorrect 47 ms 1884 KB Output isn't correct
31 Incorrect 2 ms 556 KB Output isn't correct
32 Incorrect 2 ms 380 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Partially correct 3 ms 384 KB Partially correct
3 Partially correct 2 ms 384 KB Partially correct
4 Partially correct 3 ms 384 KB Partially correct
5 Partially correct 2 ms 384 KB Partially correct
6 Partially correct 2 ms 384 KB Partially correct
7 Partially correct 2 ms 384 KB Partially correct
8 Partially correct 3 ms 384 KB Partially correct
9 Partially correct 3 ms 384 KB Partially correct
10 Partially correct 2 ms 384 KB Partially correct
11 Partially correct 3 ms 384 KB Partially correct
12 Partially correct 3 ms 384 KB Partially correct
13 Partially correct 3 ms 384 KB Partially correct
14 Partially correct 4 ms 384 KB Partially correct
15 Partially correct 3 ms 384 KB Partially correct
16 Partially correct 18 ms 768 KB Partially correct
17 Partially correct 20 ms 716 KB Partially correct
18 Partially correct 18 ms 768 KB Partially correct
19 Partially correct 17 ms 768 KB Partially correct
20 Partially correct 12 ms 768 KB Partially correct
21 Partially correct 72 ms 1912 KB Partially correct
22 Partially correct 67 ms 1912 KB Partially correct
23 Partially correct 67 ms 1916 KB Partially correct
24 Partially correct 71 ms 2040 KB Partially correct
25 Partially correct 69 ms 1956 KB Partially correct
26 Partially correct 74 ms 1992 KB Partially correct
27 Partially correct 78 ms 1912 KB Partially correct
28 Partially correct 72 ms 1912 KB Partially correct
29 Partially correct 68 ms 1912 KB Partially correct
30 Partially correct 49 ms 1864 KB Partially correct
31 Partially correct 2 ms 428 KB Partially correct
32 Partially correct 2 ms 384 KB Partially correct