답안 #1074859

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1074859 2024-08-25T15:33:48 Z alexdd Gap (APIO16_gap) C++17
8.51758 / 100
75 ms 2848 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;
    if(aux.first > mij) return recursiv(mij+1,dr);
    if(aux.second <= mij) return recursiv(st,mij);
    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 0 ms 2392 KB Output isn't correct
3 Incorrect 0 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 0 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 0 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 2484 KB Output isn't correct
14 Incorrect 1 ms 2392 KB Output isn't correct
15 Incorrect 1 ms 2460 KB Output isn't correct
16 Incorrect 15 ms 2584 KB Output isn't correct
17 Incorrect 15 ms 2392 KB Output isn't correct
18 Incorrect 18 ms 2392 KB Output isn't correct
19 Incorrect 16 ms 2392 KB Output isn't correct
20 Incorrect 13 ms 2392 KB Output isn't correct
21 Incorrect 64 ms 2728 KB Output isn't correct
22 Incorrect 66 ms 2648 KB Output isn't correct
23 Incorrect 71 ms 2672 KB Output isn't correct
24 Incorrect 64 ms 2648 KB Output isn't correct
25 Incorrect 55 ms 2844 KB Output isn't correct
26 Incorrect 69 ms 2648 KB Output isn't correct
27 Incorrect 75 ms 2648 KB Output isn't correct
28 Incorrect 66 ms 2648 KB Output isn't correct
29 Incorrect 65 ms 2648 KB Output isn't correct
30 Incorrect 59 ms 2656 KB Output isn't correct
31 Incorrect 1 ms 2392 KB Output isn't correct
32 Incorrect 0 ms 2392 KB Output isn't correct
# 결과 실행 시간 메모리 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 0 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 2 ms 2392 KB Partially correct
14 Partially correct 1 ms 2392 KB Partially correct
15 Partially correct 1 ms 2392 KB Partially correct
16 Partially correct 17 ms 2592 KB Partially correct
17 Partially correct 15 ms 2392 KB Partially correct
18 Partially correct 17 ms 2588 KB Partially correct
19 Partially correct 20 ms 2392 KB Partially correct
20 Partially correct 13 ms 2392 KB Partially correct
21 Partially correct 75 ms 2648 KB Partially correct
22 Partially correct 68 ms 2648 KB Partially correct
23 Partially correct 63 ms 2840 KB Partially correct
24 Partially correct 66 ms 2848 KB Partially correct
25 Partially correct 56 ms 2648 KB Partially correct
26 Partially correct 63 ms 2844 KB Partially correct
27 Partially correct 63 ms 2648 KB Partially correct
28 Partially correct 64 ms 2840 KB Partially correct
29 Partially correct 75 ms 2648 KB Partially correct
30 Partially correct 53 ms 2648 KB Partially correct
31 Partially correct 1 ms 2392 KB Partially correct
32 Partially correct 1 ms 2392 KB Partially correct