답안 #673693

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
673693 2022-12-21T17:30:10 Z whitewind664 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
// #include <atcoder/string>
// #include <atcoder/lazysegtree>

using namespace std;


using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;
// using mint = atcoder::modint998244353;
int INF = numeric_limits<int>::max() >> 1;
ll INFL = numeric_limits<ll>::max() >> 1;
ll mod = 998244353;

map<pll, ll> mp;
vector<int> v;
int total = 0;


void askingInit(int l, int r, int A[])
{
    if (r - l <= 1)
    {
        return;
    }
    int mid = (l + r) / 2;
    ll prevVal = A[mid];
    for (int i = mid - 1; i >= l; i--)
    {
        prevVal = Secret(A[i], prevVal);
        mp[{i,mid}] = prevVal;
    }
    prevVal = A[mid + 1];
    for (int i = mid + 2; i <= r; i++)
    {
        prevVal = Secret(A[i], prevVal);
        mp[{mid+1,i}] = prevVal;
    }

    askingInit(l, mid, A);
    askingInit(mid + 1, r, A);
}

void Init(int N, int A[])
{
    askingInit(0, N - 1, A);
    v.resize(N);
    for (int i = 0; i < N; i++)
    {
        v[i] = A[i];
    }
    // cout << total << endl;
}

int get(int L, int R)
{
    if (L == R)
    {
        return v[L];
    }
    if (mp.find({L, R}) == mp.end())
    {
        return -1;
    }
    return mp[{L, R}];
}

int Query(int L, int R)
{
    int val1, val2;
    if ((val1 = get(L, R)) != -1)
    {
        return val1;
    }
    for (int i = L; i < R; i++)
    {
        if ((val1 = get(L, i)) != -1 && (val2 = get(i + 1, R)) != -1)
        {
            return Secret(val1, val2);
        }
    }
    return -1;
}

Compilation message

secret.cpp: In function 'void askingInit(int, int, int*)':
secret.cpp:31:19: error: 'Secret' was not declared in this scope
   31 |         prevVal = Secret(A[i], prevVal);
      |                   ^~~~~~
secret.cpp:37:19: error: 'Secret' was not declared in this scope
   37 |         prevVal = Secret(A[i], prevVal);
      |                   ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:80:20: error: 'Secret' was not declared in this scope
   80 |             return Secret(val1, val2);
      |                    ^~~~~~