Submission #673692

# Submission time Handle Problem Language Result Execution time Memory
673692 2022-12-21T17:29:49 Z whitewind664 Secret (JOI14_secret) C++17
Compilation error
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;

int Secret(int X, int Y)
{
    total++;
    return 1;
}

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

/usr/bin/ld: /tmp/ccZIcSsH.o: in function `Secret(int, int)':
secret.cpp:(.text+0x0): multiple definition of `Secret(int, int)'; /tmp/cceOyy4I.o:grader-full.cpp:(.text+0x2d0): first defined here
collect2: error: ld returned 1 exit status