Submission #123024

# Submission time Handle Problem Language Result Execution time Memory
123024 2019-06-30T03:39:22 Z teki Mechanical Doll (IOI18_doll) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

typedef long long ll;

#define pb push_back
#define MS(x,y) memset((x),(y),sizeof((x)))
#define mn 1000000

using namespace std;

int n,sw,p=1;
vector<int> x(1<<20),y(1<<20);
bitset <(1<<20)> b;

int build(int left, int right) {
    if (left >= right) return 0;
    else if (right < p-n) return -1;

    int ts = sw;
    sw++;

    int mid = (left+right)/2;

    x[ts-1] = build(left, mid);
    y[ts-1] = build(mid+1, right);

    return ts;
}

void pt (int i, int j) {
    int a;

    if (b[-i]) a = y[-i-1];
    else a = x[-i-1];

    b[-i] = !b[-i];

    if (a <= 0) a = j;
    else pt(a,j);
}

void create_circuit(int m, vector<int> a) {
    n = (int)a.size();

    while (p < n) p*=2;

    build(0, p-1);

    for (int i = 1; i<n; i++) pt(-1,a[i]);
    if (n == 1) pt(-1,-1);
    pt(-1,0);

    vector<int> c(m+1, 1);
    x.resize(sw);
    y.resize(sw);

    c[0] = a[0];

    answer(c,x,y);
}

int main()
{
    #if LOCAL_DEBUG
        fstream cin("in.txt");
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    return 0;
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:59:5: error: 'answer' was not declared in this scope
   59 |     answer(c,x,y);
      |     ^~~~~~