Submission #38751

# Submission time Handle Problem Language Result Execution time Memory
38751 2018-01-06T12:17:38 Z oTTo_22 Gap (APIO16_gap) C++14
0 / 100
113 ms 5140 KB
#include <bits/stdc++.h>
#include "gap.h"
#define se second
#define fi first
using namespace std;

long long ans=0;

void func (long long L,long long R)
{
    long long mi1,ma1,mi2,ma2;
    long long mid=(L+R)/2;
    MinMax(L,mid,&mi1,&ma1);
    MinMax(mid,R,&mi2,&ma2);
    if (ma1==-1 && mi2==-1) {
        ans=max(ans,R-L);
        return;
    }
    if (ma1==-1) {
        ans=max(ans,mi2-L);
        return;
    }
    if (mi2==-1) {
        ans=max(ans,R-ma1);
        return;
    }
    if (ma1==L && mi2==R){
        ans=max(ans,R-L);
        return;
    }
    if (R-L==1){
        ans=max(ans,R-L);
        return;
    }
    if (ma1-L>ans)
        func(L,ma1);
    if (R-mi2>ans)
        func(mi2,R);
}

long long findGap(int T, int N)
{
    int m=N;
    long long Mn,Mx;
    long long S=0;
    long long TT=1000000000000000000;
    MinMax(S,TT,&Mn,&Mx);
    if (m==2)
        return Mx-Mn;
    ans=0;
    func (Mn,Mx);
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5140 KB Output is correct
2 Incorrect 0 ms 5140 KB Output isn't correct
3 Incorrect 0 ms 5140 KB Output isn't correct
4 Incorrect 0 ms 5140 KB Output isn't correct
5 Incorrect 0 ms 5140 KB Output isn't correct
6 Incorrect 0 ms 5140 KB Output isn't correct
7 Incorrect 0 ms 5140 KB Output isn't correct
8 Incorrect 0 ms 5140 KB Output isn't correct
9 Incorrect 0 ms 5140 KB Output isn't correct
10 Incorrect 0 ms 5140 KB Output isn't correct
11 Incorrect 0 ms 5140 KB Output isn't correct
12 Incorrect 0 ms 5140 KB Output isn't correct
13 Incorrect 0 ms 5140 KB Output isn't correct
14 Incorrect 0 ms 5140 KB Output isn't correct
15 Incorrect 0 ms 5140 KB Output isn't correct
16 Incorrect 16 ms 5140 KB Output isn't correct
17 Incorrect 13 ms 5140 KB Output isn't correct
18 Incorrect 16 ms 5140 KB Output isn't correct
19 Incorrect 9 ms 5140 KB Output isn't correct
20 Incorrect 23 ms 5140 KB Output isn't correct
21 Incorrect 49 ms 5140 KB Output isn't correct
22 Incorrect 49 ms 5140 KB Output isn't correct
23 Incorrect 59 ms 5140 KB Output isn't correct
24 Incorrect 53 ms 5140 KB Output isn't correct
25 Incorrect 113 ms 5140 KB Output isn't correct
26 Incorrect 63 ms 5140 KB Output isn't correct
27 Incorrect 56 ms 5140 KB Output isn't correct
28 Incorrect 63 ms 5140 KB Output isn't correct
29 Incorrect 49 ms 5140 KB Output isn't correct
30 Incorrect 113 ms 5140 KB Output isn't correct
31 Incorrect 0 ms 5140 KB Output isn't correct
32 Incorrect 0 ms 5140 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5140 KB Output is correct
2 Incorrect 0 ms 5140 KB Output isn't correct
3 Incorrect 0 ms 5140 KB Output isn't correct
4 Incorrect 0 ms 5140 KB Output isn't correct
5 Partially correct 0 ms 5140 KB Partially correct
6 Incorrect 0 ms 5140 KB Output isn't correct
7 Incorrect 0 ms 5140 KB Output isn't correct
8 Incorrect 0 ms 5140 KB Output isn't correct
9 Incorrect 0 ms 5140 KB Output isn't correct
10 Incorrect 0 ms 5140 KB Output isn't correct
11 Incorrect 0 ms 5140 KB Output isn't correct
12 Incorrect 0 ms 5140 KB Output isn't correct
13 Incorrect 0 ms 5140 KB Output isn't correct
14 Incorrect 0 ms 5140 KB Output isn't correct
15 Partially correct 0 ms 5140 KB Partially correct
16 Incorrect 13 ms 5140 KB Output isn't correct
17 Incorrect 13 ms 5140 KB Output isn't correct
18 Incorrect 13 ms 5140 KB Output isn't correct
19 Incorrect 13 ms 5140 KB Output isn't correct
20 Incorrect 26 ms 5140 KB Output isn't correct
21 Incorrect 39 ms 5140 KB Output isn't correct
22 Incorrect 53 ms 5140 KB Output isn't correct
23 Incorrect 43 ms 5140 KB Output isn't correct
24 Incorrect 56 ms 5140 KB Output isn't correct
25 Partially correct 103 ms 5140 KB Partially correct
26 Incorrect 49 ms 5140 KB Output isn't correct
27 Incorrect 59 ms 5140 KB Output isn't correct
28 Incorrect 69 ms 5140 KB Output isn't correct
29 Incorrect 46 ms 5140 KB Output isn't correct
30 Incorrect 106 ms 5140 KB Output isn't correct
31 Partially correct 0 ms 5140 KB Partially correct
32 Incorrect 0 ms 5140 KB Output isn't correct