답안 #915653

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
915653 2024-01-24T13:19:18 Z typ_ik 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h> 

#define watch(x) cout << (#x) << " : " << x << '\n'
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ll long long 

using namespace std;   

const int N = 1000 + 128;
int t[4 * N], a[N];
map <int, map<int, int> > was;
int cnt = 0;

// int secret(int x, int y) { 
//     return min((int)1e9, x + 2 * (y/2));
// }

int ask(int x, int y) { 
    if (x > y)
        swap(x, y); 
    if (x == -1)
        return y;
    if (was.count(x) && was[x].count(y))
        return was[x][y];
    ++cnt;
    return was[x][y] = Secret(x, y);
}

void build(int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = a[tl];
        return;
    } 
    int tm = (tl + tr) >> 1;
    build(v << 1, tl, tm);
    build(v << 1 | 1, tm + 1, tr);
    t[v] = ask(t[v << 1], t[v << 1 | 1]);
}

int get(int l, int r, int v, int tl, int tr) {
    if (tl > r || tr < l)
        return -1;
    if (l <= tl && tr <= r)
        return t[v];
    int tm = (tl + tr) >> 1;
    return ask(get(l, r, v << 1, tl, tm),
            get(l, r, v << 1 | 1, tm + 1, tr));
}

int n;

void Init(int N, int A[])  {
    n = N;
    for (int x = 0; x < n; x++)
        a[x] = A[x];
    build(1, 0, n - 1);
}

int Query(int L, int R) {
    return get(L, R, 1, 0, n - 1);
} 

// main() {
//     boost;  
//     srand(time(NULL));
//     solve();
//     return 0;
// }

Compilation message

secret.cpp: In function 'int ask(int, int)':
secret.cpp:28:24: error: 'Secret' was not declared in this scope
   28 |     return was[x][y] = Secret(x, y);
      |                        ^~~~~~