답안 #1074858

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1074858 2024-08-25T15:32:34 Z alexdd Gap (APIO16_gap) C++17
8.44997 / 100
84 ms 2896 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 = 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;
    return combine(recursiv(st,mij),recursiv(mij+1,dr));
}
long long findGap(int32_t T, int32_t N)
{
    node aux = recursiv(0,INF);
    return aux.rez;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Incorrect 1 ms 2392 KB Output isn't correct
4 Incorrect 0 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 0 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 2 ms 2392 KB Output isn't correct
13 Incorrect 1 ms 2392 KB Output isn't correct
14 Incorrect 2 ms 2392 KB Output isn't correct
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Incorrect 17 ms 2480 KB Output isn't correct
17 Incorrect 17 ms 2392 KB Output isn't correct
18 Incorrect 20 ms 2592 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 71 ms 2844 KB Output isn't correct
22 Incorrect 82 ms 2640 KB Output isn't correct
23 Incorrect 73 ms 2896 KB Output isn't correct
24 Incorrect 71 ms 2648 KB Output isn't correct
25 Incorrect 56 ms 2740 KB Output isn't correct
26 Incorrect 72 ms 2648 KB Output isn't correct
27 Incorrect 72 ms 2840 KB Output isn't correct
28 Incorrect 77 ms 2728 KB Output isn't correct
29 Incorrect 78 ms 2840 KB Output isn't correct
30 Incorrect 54 ms 2648 KB Output isn't correct
31 Incorrect 0 ms 2392 KB Output isn't correct
32 Incorrect 1 ms 2392 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 2388 KB Partially correct
2 Partially correct 0 ms 2392 KB Partially correct
3 Partially correct 1 ms 2392 KB Partially correct
4 Partially correct 1 ms 2392 KB Partially correct
5 Partially correct 1 ms 2392 KB Partially correct
6 Partially correct 0 ms 2392 KB Partially correct
7 Partially correct 1 ms 2392 KB Partially correct
8 Partially correct 0 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 2388 KB Partially correct
14 Partially correct 2 ms 2392 KB Partially correct
15 Partially correct 1 ms 2392 KB Partially correct
16 Partially correct 17 ms 2488 KB Partially correct
17 Partially correct 17 ms 2392 KB Partially correct
18 Partially correct 17 ms 2392 KB Partially correct
19 Partially correct 18 ms 2392 KB Partially correct
20 Partially correct 13 ms 2392 KB Partially correct
21 Partially correct 84 ms 2844 KB Partially correct
22 Partially correct 70 ms 2648 KB Partially correct
23 Partially correct 73 ms 2648 KB Partially correct
24 Partially correct 70 ms 2648 KB Partially correct
25 Partially correct 64 ms 2840 KB Partially correct
26 Partially correct 71 ms 2648 KB Partially correct
27 Partially correct 69 ms 2840 KB Partially correct
28 Partially correct 78 ms 2840 KB Partially correct
29 Partially correct 71 ms 2648 KB Partially correct
30 Partially correct 54 ms 2648 KB Partially correct
31 Partially correct 1 ms 2392 KB Partially correct
32 Partially correct 0 ms 2392 KB Partially correct