답안 #957980

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
957980 2024-04-04T15:24:49 Z wksp 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include"sectet.h"
using namespace std;

// int Secret(int X, int Y){
//     int a;
//     cin >> a;
//     return a;
// }
const int n_max = 1024;
const int log = 12;
int tab[log][n_max];
// int tabr[log][n_max];
map<pair<int, int>, int> result_in_past; 

int check(int a, int b){
    if(result_in_past.find({a, b}) != result_in_past.end()){
        return result_in_past[{a, b}];
    }else{
        int x = Secret(a, b);
        result_in_past[{a, b}] = x;
        return x;
    }
}

void init_tree(int n, int lvl = 10, int l = 0, int r = n_max - 1){
    if(l > n){
        return;
    }
    if(lvl == 0){
        return;
    }
    int mid = (l+r)/2;
    init_tree(n, lvl - 1, l, mid);
    init_tree(n, lvl - 1, mid + 1, r);
    if(mid >= n){
        return;
    }

    tab[lvl][mid] = tab[0][mid];
    for(int i = mid - 1; i >= l; i--){
        tab[lvl][i] = check(tab[0][i], tab[lvl][i+1]);
    }
    tab[lvl][mid + 1] = tab[0][mid+1];
    for(int i = mid + 2; i <= min(n, r); i++){
        tab[lvl][i] = check(tab[lvl][i-1], tab[0][i]);
    }
}

int find_in_tree(int a, int b, int lvl = 10, int l = 0, int r = n_max - 1){
    int mid = (l+r)/2;
    if(r <= mid){
        return find_in_tree(a, b, lvl - 1, l, mid);
    }
    if(l > mid){
        return find_in_tree(a, b, lvl - 1, mid + 1, r);
    }
    return check(tab[lvl][l], tab[lvl][r]);
}

void Init(int N, int A[]){
    for(int i = 0; i < N; i++){
        tab[0][i] = A[i];
    }
    init_tree(N);
}

int Query(int L, int R){
    if(L == R){
        return tab[0][L];
    }
    return find_in_tree(L, R);
}

Compilation message

secret.cpp:2:9: fatal error: sectet.h: No such file or directory
    2 | #include"sectet.h"
      |         ^~~~~~~~~~
compilation terminated.