Submission #1074861

# Submission time Handle Problem Language Result Execution time Memory
1074861 2024-08-25T15:35:36 Z alexdd Gap (APIO16_gap) C++17
10.06 / 100
69 ms 2860 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e18;
pair<int,int> qry(int le, int ri)
{
    pair<int,int> aux;
    MinMax(le,ri,&aux.first,&aux.second);
    return aux;
}
struct node
{
    int prim,ult,rez;
};
node combine(node x, node y)
{
    if(x.ult==-1)
        return y;
    if(y.ult==-1)
        return x;
    node aux;
    aux.rez = max({x.rez, y.rez, y.prim - x.ult});
    aux.prim = x.prim;
    aux.ult = y.ult;
    return aux;
}
node recursiv(int st, int dr, pair<int,int> aux)
{
    if(aux.first==-1) aux = qry(st,dr);
    if(aux.first==-1) return {-1,-1,-1};
    if(aux.first==aux.second) return {aux.first,aux.first,0};
    int mij=(st+dr)/2;
    if(aux.first > mij) return recursiv(mij+1,dr,aux);
    if(aux.second <= mij) return recursiv(st,mij,aux);
    return combine(recursiv(st,mij,{-1,-1}),recursiv(mij+1,dr,{-1,-1}));
}
long long findGap(int32_t T, int32_t N)
{
    node aux = recursiv(0,INF,{-1,-1});
    return aux.rez;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 0 ms 2392 KB Output isn't correct
3 Incorrect 0 ms 2392 KB Output isn't correct
4 Incorrect 1 ms 2392 KB Output isn't correct
5 Incorrect 0 ms 2392 KB Output isn't correct
6 Incorrect 1 ms 2392 KB Output isn't correct
7 Incorrect 1 ms 2392 KB Output isn't correct
8 Incorrect 1 ms 2392 KB Output isn't correct
9 Incorrect 1 ms 2392 KB Output isn't correct
10 Incorrect 1 ms 2392 KB Output isn't correct
11 Incorrect 1 ms 2392 KB Output isn't correct
12 Incorrect 1 ms 2392 KB Output isn't correct
13 Incorrect 1 ms 2392 KB Output isn't correct
14 Incorrect 1 ms 2500 KB Output isn't correct
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Incorrect 14 ms 2532 KB Output isn't correct
17 Incorrect 14 ms 2588 KB Output isn't correct
18 Incorrect 15 ms 2564 KB Output isn't correct
19 Incorrect 17 ms 2392 KB Output isn't correct
20 Incorrect 14 ms 2392 KB Output isn't correct
21 Incorrect 65 ms 2748 KB Output isn't correct
22 Incorrect 69 ms 2648 KB Output isn't correct
23 Incorrect 59 ms 2860 KB Output isn't correct
24 Incorrect 57 ms 2848 KB Output isn't correct
25 Incorrect 55 ms 2648 KB Output isn't correct
26 Incorrect 58 ms 2648 KB Output isn't correct
27 Incorrect 68 ms 2648 KB Output isn't correct
28 Incorrect 58 ms 2848 KB Output isn't correct
29 Incorrect 58 ms 2648 KB Output isn't correct
30 Incorrect 60 ms 2648 KB Output isn't correct
31 Incorrect 1 ms 2392 KB Output isn't correct
32 Incorrect 1 ms 2392 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 2392 KB Partially correct
2 Partially correct 0 ms 2392 KB Partially correct
3 Partially correct 0 ms 2392 KB Partially correct
4 Partially correct 1 ms 2392 KB Partially correct
5 Partially correct 0 ms 2392 KB Partially correct
6 Partially correct 1 ms 2392 KB Partially correct
7 Partially correct 1 ms 2392 KB Partially correct
8 Partially correct 1 ms 2392 KB Partially correct
9 Partially correct 0 ms 2392 KB Partially correct
10 Partially correct 0 ms 2392 KB Partially correct
11 Partially correct 1 ms 2392 KB Partially correct
12 Partially correct 1 ms 2392 KB Partially correct
13 Partially correct 1 ms 2392 KB Partially correct
14 Partially correct 1 ms 2488 KB Partially correct
15 Partially correct 1 ms 2392 KB Partially correct
16 Partially correct 14 ms 2592 KB Partially correct
17 Partially correct 15 ms 2392 KB Partially correct
18 Partially correct 18 ms 2392 KB Partially correct
19 Partially correct 14 ms 2392 KB Partially correct
20 Partially correct 13 ms 2392 KB Partially correct
21 Partially correct 67 ms 2648 KB Partially correct
22 Partially correct 58 ms 2648 KB Partially correct
23 Partially correct 68 ms 2648 KB Partially correct
24 Partially correct 57 ms 2792 KB Partially correct
25 Partially correct 56 ms 2648 KB Partially correct
26 Partially correct 66 ms 2648 KB Partially correct
27 Partially correct 59 ms 2796 KB Partially correct
28 Partially correct 57 ms 2840 KB Partially correct
29 Partially correct 58 ms 2648 KB Partially correct
30 Partially correct 53 ms 2840 KB Partially correct
31 Partially correct 1 ms 2392 KB Partially correct
32 Partially correct 1 ms 2392 KB Partially correct