Submission #1340992

#TimeUsernameProblemLanguageResultExecution timeMemory
1340992SulAMechanical Doll (IOI18_doll)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define all(a) (a).begin(), (a).end()
#define popcount __builtin_popcountll
using namespace std;
using namespace __gnu_pbds;
template<typename T> using ordered_set = tree<T, null_type, less_equal<>, rb_tree_tag, tree_order_statistics_node_update>;

void answer(std::vector<int> C, std::vector<int> X, std::vector<int> Y);

const int N = 5e5;
int L[N], R[N], dir[N];
int node = 0;

int construct(int k, int root, int daddy = -1) {
    node = max(node, root);
    // cout<<k<<" "<<root<<" "<<daddy<<"\n";
    if (k == 2) {
        L[root] = 676767;
        R[root] = daddy == -1 ? 676767 : daddy;
        return root;
    }
    if (k % 2 == 0) {
        L[root] = construct(k/2, node + 1);
        R[root] = construct(k/2, node + 1, daddy);
        return root;
    } else {
        L[root] = construct(1 + k / 2, node + 1, root);
        R[root] = construct(1 + k / 2, node + 1, daddy);
        return root;
    }
}

void add_leaf(int root, int val) {
    int& go = dir[root] == 0 ? L[root] : R[root];
    dir[root] ^= 1;
    if (go < 0)
        add_leaf(0, val);
    else if (go == 676767)
        go = val;
    else
        add_leaf(go, val);
}

void create_circuit(int m, std::vector<int> A) {
    fill(L, L + N, 7e7);
    fill(R, R + N, 7e7);
    A.push_back(0);
    int n = A.size();
    int root = 0;
    construct(n, root);
    for (int x : A)
        add_leaf(0, ~x);
    vector<int> C(m+1, -1);
    vector<int> X, Y;
    for (int i = 0; i < 2*(n-1); i++) {
        if (L[i] == 7e7 && R[i] == 7e7) continue;
        X.push_back(~L[i]);
        Y.push_back(~R[i]);
    }
    answer(C, X, Y);
}co

Compilation message (stderr)

doll.cpp:63:2: error: 'co' does not name a type
   63 | }co
      |  ^~