답안 #236658

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
236658 2020-06-02T18:16:20 Z DS007 비밀 (JOI14_secret) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

const int N_ = 1000;
int val[N_][N_];
bool done[N_][N_];

int n, *a;

void pre(int l, int r) {
    if (l == r)
        return;

    int mid = (l + r) / 2;
    for (int i = mid - 1, temp = a[mid]; i >= l; i--) {
        if (done[i][mid]) {
            temp = val[i][mid];
            continue;
        }

        temp = Secret(a[i], temp);
        val[i][mid] = temp;
        done[i][mid] = true;
    }

    for (int i = mid + 2, temp = a[mid + 1]; i <= r; i++) {
        if (done[mid + 1][i]) {
            temp = val[mid + 1][i];
            continue;
        }

        temp = Secret(temp, a[i]);
        val[mid + 1][i] = temp;
        done[mid + 1][i] = true;
    }

    pre(l, mid);
    pre(mid + 1, r);
}

void Init(int N, int A[]) {
    n = N;
    a = A;

    for (int i = 0; i < n; i++)
        val[i][i] = a[i], done[i][i] = true;

    pre(0, n - 1);
}

int query_util(int l, int r, int tl, int tr) {
    int mid = (l + r) / 2;
    if (tl <= mid && mid < tr)
        return Secret(val[tl][mid], val[mid + 1][tr]);
    else if (tr <= mid)
        return query_util(l, mid, tl, tr);
    else
        return query_util(mid + 1, r, tl, tr);
}

int Query(int L, int R) {
    if (done[L][R])
        return val[L][R];
    return query_util(0, n - 1, L, R);
}

Compilation message

secret.cpp: In function 'void pre(int, int)':
secret.cpp:21:16: error: 'Secret' was not declared in this scope
         temp = Secret(a[i], temp);
                ^~~~~~
secret.cpp:21:16: note: suggested alternative: 'qecvt'
         temp = Secret(a[i], temp);
                ^~~~~~
                qecvt
secret.cpp:32:16: error: 'Secret' was not declared in this scope
         temp = Secret(temp, a[i]);
                ^~~~~~
secret.cpp:32:16: note: suggested alternative: 'qecvt'
         temp = Secret(temp, a[i]);
                ^~~~~~
                qecvt
secret.cpp: In function 'int query_util(int, int, int, int)':
secret.cpp:54:16: error: 'Secret' was not declared in this scope
         return Secret(val[tl][mid], val[mid + 1][tr]);
                ^~~~~~
secret.cpp:54:16: note: suggested alternative: 'qecvt'
         return Secret(val[tl][mid], val[mid + 1][tr]);
                ^~~~~~
                qecvt