답안 #115997

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
115997 2019-06-10T07:01:06 Z minhcool 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;

int ans[1001][11], n, b[1001];

int ask(int x, int y){
    return Secret(x, y);
}

void build(){
    for(int i = 1; i <= n; i++) ans[i][0] = b[i];
    for(int i = 1; i < 10; i++){
        int tmp = 1 << i;
        for(int j = 1; j + tmp <= n; j++) ans[j][i] = ask(ans[j][i - 1], ans[j + (1 << (i - 1))][i - 1]);
    }
}

void Init(int N, int A[]){
    n = N;
    for(int i = 1; i <= n; i++) b[i] = A[i - 1];
}

int Query(int x, int y){
    x--;
    y--;
    int tmp = x, answer = 0;
    for(int i = 9; i >= 0; i--){
        if(tmp + (1 << i) > y) continue;
        if(!ans) answer = ans[tmp][i];
        else answer = ask(answer, ans[tmp][i]);
        tmp += (1 << i);
    }
    return answer;
}

Compilation message

secret.cpp: In function 'int ask(int, int)':
secret.cpp:7:12: error: 'Secret' was not declared in this scope
     return Secret(x, y);
            ^~~~~~
secret.cpp:7:12: note: suggested alternative: 'qecvt'
     return Secret(x, y);
            ^~~~~~
            qecvt