Submission #442666

# Submission time Handle Problem Language Result Execution time Memory
442666 2021-07-08T14:26:31 Z Lam_lai_cuoc_doi ICC (CEOI16_icc) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

constexpr bool typetest = 1;
constexpr int N = 1e2 + 5;
struct dsu
{
    int n;
    int par[N];
    dsu()
    {
        memset(par, -1, sizeof par);
    }
    int findpar(int v)
    {
        return par[v] < 0 ? v : par[v] = findpar(par[v]);
    }
    void Merge(int u, int v)
    {
        u = findpar(u);
        v = findpar(v);
        if (u == v)
            return;
        if (par[u] < par[v])
            swap(u, v);
        par[v] += par[u];
        par[u] = v;
    }
} f;
int a[N], b[N], x, y, c[N];

#define bit(i, x) (((x) >> (i)) & 1)

int Cal(int m, int a[N], int n, int b[N])
{
    int l = 1, r = m;
    while (l <= r)
    {
        int mid = (l + r) / 2;
        for (int i = l; i <= mid; ++i)
            c[i - l + 1] = a[l];

        if (query(mid - l + 1, n, c, b))
            r = mid - 1;
        else
            l = mid + 1;
    }

    return l;
}

void run(int n)
{
    f.n = n;
    for (int i = 1; i < n; ++i)
    {
        for (int j = 6; ~j; --j)
        {
            x = 0;
            y = 0;
            for (int t = 1; t <= n; ++t)
                if (bit(j, f.findpar(t)))
                    a[++x] = t;
                else
                    b[++y] = t;
            if (x != 0 && y != 0 && query(x, y, a, b))
                break;
        }
        if (x != 1)
        {
            a[1] = Cal(x, a, y, b);
            x = 1;
        }
        if (y != 1)
        {
            b[1] = Cal(y, b, x, a);
            y = 1;
        }
        f.Merge(a[1], b[1]);
        setRoad(a[1], b[1]);
    }
}

Compilation message

icc.cpp: In function 'int Cal(int, int*, int, int*)':
icc.cpp:47:13: error: 'query' was not declared in this scope
   47 |         if (query(mid - l + 1, n, c, b))
      |             ^~~~~
icc.cpp: In function 'void run(int)':
icc.cpp:70:37: error: 'query' was not declared in this scope
   70 |             if (x != 0 && y != 0 && query(x, y, a, b))
      |                                     ^~~~~
icc.cpp:84:9: error: 'setRoad' was not declared in this scope
   84 |         setRoad(a[1], b[1]);
      |         ^~~~~~~