답안 #893516

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
893516 2023-12-27T06:10:04 Z Faisal_Saqib Split the Attractions (IOI19_split) C++17
컴파일 오류
0 ms 0 KB
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define sc second

const int size = 100 * 1000;
const int magic_max = 20;
//const int ops = 100 * 1000 * 1000;
const int iters = 100;
const double timelimit = 1.5;

vector <int> vertex[size];
queue <int> bq[magic_max];
int col[size];
bool used[magic_max][size];
int intime[size];
bool used_small[magic_max];
bool connected[1 << magic_max];
unsigned int way[magic_max];
vector <pair <int, int> > edges;
vector <int> vertex_tree[size];
int par[size];
int depth[size];
int subsize[size];

void tree_dfs(int v, int from) {
    subsize[v] = 1;
    for (int e : vertex_tree[v]) {
        if (e != from) {
	    depth[e] = depth[v] + 1;
	    tree_dfs(e, v);
	    subsize[v] += subsize[e];
	}
    }
}

int getpar(int v) {
    if (par[v] != v) {
        par[v] = getpar(par[v]);
    }

    return par[v];
}

void build_random_span(int n) {
    for (int i = 0; i < n; i++) {
    	vertex_tree[i].clear();
	par[i] = i;
    }

    random_shuffle(edges.begin(), edges.end());
    int m = edges.size();

    for (int i = 0; i < m; i++) {
    	int u = edges[i].fs;
	int v = edges[i].sc;

	u = getpar(u);
	v = getpar(v);
	if (u != v) {
	    vertex_tree[edges[i].fs].pb(edges[i].sc);
            vertex_tree[edges[i].sc].pb(edges[i].fs);
	}

	par[u] = v;
    }
}

int find_centroid(int n) {
    depth[0] = 0;
    tree_dfs(0, -1);

    int cen = 0;
    for (int i = 0; i < n; i++) {
        if (subsize[i] >= (n + 1) / 2 && depth[i] > depth[cen]) {
	    cen = i;
	}
    }

    return cen;
}
/*
vector <int> random_span_sol(int n, int a, int b, int c) {
    build_random_span(n);
    random_shuffle(edges.begin(), edges.end());

    int cen = find_centroid(n);
}
*/
int random_span_centroid(int n) {
    build_random_span(n);
    random_shuffle(edges.begin(), edges.end());

    return find_centroid(n);
}

void recolor(int n, int tg, int res, int cnt, unsigned int mask, vector <int>& ans) {
    queue <int> q;
    int stp = -1;
    for (int i = 0; i < n; i++) {
        used[0][i] = false;
    	if ((mask >> col[i]) & 1) {
            stp = i;
	}
    }

    q.push(stp);
    used[0][stp] = true;
    while (!q.empty()) {
        int v = q.front();
        q.pop();

        if (cnt > 0) {
            ans[v] = tg;
            cnt--;
        } else {
            ans[v] = res;
        }

        for (int e : vertex[v]) {
            if (!used[0][e] && ((mask >> col[e]) & 1)) {
                q.push(e);
                used[0][e] = true;
            }
        }
    }
}

void run_parallel_bfs(int n, const vector<int>& nodes) {
    for (int i = 0; i < n; i++) {
        col[i] = -1;
    }

    int magic = nodes.size();

    for (int i = 0; i < magic; i++) {
        for (int j = 0; j < n; j++) {
            used[i][j] = false;
        }
    }

    for (int i = 0; i < magic; i++) {
    	bq[i].push(nodes[i]);
        used[i][nodes[i]] = true;
    }

    int used_cnt = 0;
    bool flag = true;
    while (flag) {
        flag = false;
        for (int i = 0; i < magic; i++) {
            int cur = -1;
            while (!bq[i].empty() && cur == -1) {
                cur = bq[i].front();
                bq[i].pop();
                if (col[cur] != -1) {
                    cur = -1;
                }
            }
            if (cur == -1) {
                continue;
            }
	    used_cnt++;
            flag = true;

            col[cur] = i;
	    if (i == magic - 1) {
	    	continue;
	    }
            for (int e : vertex[cur]) {
                if (!used[i][e] && col[e] == -1) {
                    used[i][e] = true;
                    bq[i].push(e);
                }
            }
        }
    }

    if (used_cnt < n) {
    	bq[magic - 1].push(nodes[magic - 1]);
	while (!bq[magic - 1].empty()) {
	    int cur = bq[magic - 1].front();
	    bq[magic - 1].pop();

	    col[cur] = magic - 1;
	    for (int e : vertex[cur]) {
                if (col[e] == -1) {
		    col[e] = magic - 1;
		    bq[magic - 1].push(e);
		}
	    }
	}
    }
}

void build_colors_graph(int n, int magic) {
    for (int i = 0; i < magic; i++) {
        for (int j = 0; j < magic; j++) {
            way[i] = 0u;
        }
    }
    for (int i = 0; i < magic; i++) {
        way[i] |= (1u << i);
    }

    for (int i = 0; i < n; i++) {
        for (int e : vertex[i]) {
            way[col[i]] |= (1u << col[e]);
            way[col[e]] |= (1u << col[i]);
        }
    }

    connected[0] = true;
    for (unsigned int mask = 1u; mask < (1u << magic); mask++) {
	connected[mask] = false;
    	for (int i = 0; i < magic; i++) {
	    if ((mask >> i) & 1) {
		unsigned int newmask = mask ^ (1 << i);
	        if (newmask == 0u) {
		    connected[mask] = true;
		    break;
		}
		if (connected[newmask] && (newmask & way[i])) {
	            connected[mask] = true;
		    break;
		}
	    }
	}
    }
}

void dfs_small(int magic, int v, unsigned int mask) {
    used_small[v] = true;
    for (int i = 0; i < magic; i++) {
        if (((way[v] >> i) & 1) && ((mask >> i) & 1) && !used_small[i]) {
            dfs_small(magic, i, mask);
        }
    }
}

bool is_connected(int magic, unsigned int mask) {
    //cerr << magic << ' ' << mask << endl;
    for (int i = 0; i < magic; i++) {
        used_small[i] = false;
    }
    int sp = -1;
    for (int i = 0; i < magic; i++) {
        if ((mask >> i) & 1) {
            sp = i;
            break;
        }
    }

    if (sp == -1) {
        return true;
    }

    dfs_small(magic, sp, mask);

    for (int i = 0; i < magic; i++) {
        if (((mask >> i) & 1) && !used_small[i]) {
            return false;
        }
    }

    return true;
}

vector <int> rand_order;

vector <int> try_random_bfs(int n, int a, int b, int c, int magic) {
    for (int i = 0; i < n; i++) {
        random_shuffle(vertex[i].begin(), vertex[i].end());
    }
    random_shuffle(rand_order.begin(), rand_order.end());

    vector <int> nodes = {rand_order.begin(), rand_order.begin() + magic};

    int cen = random_span_centroid(n);
    for (int i = 0; i < (int) nodes.size(); i++) {
        if (nodes[i] == cen) {
	    swap(nodes[i], nodes.back());
	}
    }
    nodes[(int) nodes.size() - 1] = cen;

    run_parallel_bfs(n, nodes);

    vector <pair <int, int> > sizes;
    sizes.pb(mp(a, 1));
    sizes.pb(mp(b, 2));
    sizes.pb(mp(c, 3));

    sort(sizes.begin(), sizes.end());

    vector <int> colcnt(magic, 0);
    for (int i = 0; i < n; i++) {
        colcnt[col[i]]++;
    }

    build_colors_graph(n, magic);

    unsigned int allmask = (1 << magic) - 1;
    for (unsigned int mask = 0u; mask <= allmask; mask++) {
        unsigned int sup = allmask ^ mask;

        int cnt0 = 0;
        int cnt1 = 0;
        for (int i = 0; i < magic; i++) {
            if ((mask >> i) & 1) {
                cnt0 += colcnt[i];
            }
            if ((sup >> i) & 1) {
                cnt1 += colcnt[i];
            }
        }

        if (cnt0 > cnt1) {
            continue;
        }
        if (sizes[0].fs > cnt0 || sizes[1].fs > cnt1) {
            continue;
        }

        if (connected[mask] && connected[sup]) {
            vector <int> ans(n, -1);
            recolor(n, sizes[0].sc, sizes[2].sc, sizes[0].fs, mask, ans);
            recolor(n, sizes[1].sc, sizes[2].sc, sizes[1].fs, sup, ans);
/*
	    for (int i = 0; i < n; i++) {
	        cerr << col[i] << ' ';
	    }
	    cerr << endl;
            for (int i = 0; i < magic; i++) {
                cerr << ans[i] << ' ';
	    }
	    cerr << endl;
*/
            return ans;
        }
    }

    return vector <int>();
}

vector<int> find_split(int n, int a, int b, int c, vector <int> p, vector <int> q) {
    for (int i = 0; i < n; i++) {
        vertex[i].clear();
    }
    int m = p.size();
    for (int i = 0; i < m; i++) {
        vertex[p[i]].pb(q[i]);
        vertex[q[i]].pb(p[i]);
    }
    for (int i = 0; i < m; i++) {
    	edges.pb(mp(p[i], q[i]));
    }

    for (int i = 0; i < n; i++) {
        rand_order.pb(i);
    }

    //for (int it = 0; it < iters; it++) {
    while ((clock() + 0.0) / CLOCKS_PER_SEC < timelimit) {
        vector <int> res = try_random_bfs(n, a, b, c, min(magic_max, n));
        if (!res.empty()) {
            return res;
	}
    }

    return vector<int>(n, 0);
}

Compilation message

split.cpp:30:21: error: reference to 'size' is ambiguous
   30 | vector <int> vertex[size];
      |                     ^~~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from split.cpp:3:
/usr/include/c++/10/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
split.cpp:24:11: note:                 'const int size'
   24 | const int size = 100 * 1000;
      |           ^~~~
split.cpp:32:9: error: reference to 'size' is ambiguous
   32 | int col[size];
      |         ^~~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from split.cpp:3:
/usr/include/c++/10/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
split.cpp:24:11: note:                 'const int size'
   24 | const int size = 100 * 1000;
      |           ^~~~
split.cpp:33:22: error: reference to 'size' is ambiguous
   33 | bool used[magic_max][size];
      |                      ^~~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from split.cpp:3:
/usr/include/c++/10/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
split.cpp:24:11: note:                 'const int size'
   24 | const int size = 100 * 1000;
      |           ^~~~
split.cpp:34:12: error: reference to 'size' is ambiguous
   34 | int intime[size];
      |            ^~~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from split.cpp:3:
/usr/include/c++/10/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
split.cpp:24:11: note:                 'const int size'
   24 | const int size = 100 * 1000;
      |           ^~~~
split.cpp:39:26: error: reference to 'size' is ambiguous
   39 | vector <int> vertex_tree[size];
      |                          ^~~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from split.cpp:3:
/usr/include/c++/10/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
split.cpp:24:11: note:                 'const int size'
   24 | const int size = 100 * 1000;
      |           ^~~~
split.cpp:40:9: error: reference to 'size' is ambiguous
   40 | int par[size];
      |         ^~~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from split.cpp:3:
/usr/include/c++/10/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
split.cpp:24:11: note:                 'const int size'
   24 | const int size = 100 * 1000;
      |           ^~~~
split.cpp:41:11: error: reference to 'size' is ambiguous
   41 | int depth[size];
      |           ^~~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from split.cpp:3:
/usr/include/c++/10/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
split.cpp:24:11: note:                 'const int size'
   24 | const int size = 100 * 1000;
      |           ^~~~
split.cpp:42:13: error: reference to 'size' is ambiguous
   42 | int subsize[size];
      |             ^~~~
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from split.cpp:3:
/usr/include/c++/10/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/10/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
split.cpp:24:11: note:                 'const int size'
   24 | const int size = 100 * 1000;
      |           ^~~~
split.cpp: In function 'void tree_dfs(int, int)':
split.cpp:45:5: error: 'subsize' was not declared in this scope; did you mean 'size'?
   45 |     subsize[v] = 1;
      |     ^~~~~~~
      |     size
split.cpp:46:18: error: 'vertex_tree' was not declared in this scope
   46 |     for (int e : vertex_tree[v]) {
      |                  ^~~~~~~~~~~
split.cpp:48:6: error: 'depth' was not declared in this scope
   48 |      depth[e] = depth[v] + 1;
      |      ^~~~~
split.cpp: In function 'int getpar(int)':
split.cpp:56:9: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   56 |     if (par[v] != v) {
      |         ^~~
      |         __pstl::execution::v1::par
In file included from /usr/include/c++/10/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/10/algorithm:74,
                 from split.cpp:4:
/usr/include/c++/10/pstl/execution_defs.h:111:27: note: '__pstl::execution::v1::par' declared here
  111 | constexpr parallel_policy par{};
      |                           ^~~
split.cpp:60:12: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   60 |     return par[v];
      |            ^~~
      |            __pstl::execution::v1::par
In file included from /usr/include/c++/10/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/10/algorithm:74,
                 from split.cpp:4:
/usr/include/c++/10/pstl/execution_defs.h:111:27: note: '__pstl::execution::v1::par' declared here
  111 | constexpr parallel_policy par{};
      |                           ^~~
split.cpp: In function 'void build_random_span(int)':
split.cpp:65:6: error: 'vertex_tree' was not declared in this scope
   65 |      vertex_tree[i].clear();
      |      ^~~~~~~~~~~
split.cpp:66:2: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   66 |  par[i] = i;
      |  ^~~
      |  __pstl::execution::v1::par
In file included from /usr/include/c++/10/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/10/algorithm:74,
                 from split.cpp:4:
/usr/include/c++/10/pstl/execution_defs.h:111:27: note: '__pstl::execution::v1::par' declared here
  111 | constexpr parallel_policy par{};
      |                           ^~~
split.cpp:79:6: error: 'vertex_tree' was not declared in this scope
   79 |      vertex_tree[edges[i].fs].pb(edges[i].sc);
      |      ^~~~~~~~~~~
split.cpp:83:2: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   83 |  par[u] = v;
      |  ^~~
      |  __pstl::execution::v1::par
In file included from /usr/include/c++/10/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/10/algorithm:74,
                 from split.cpp:4:
/usr/include/c++/10/pstl/execution_defs.h:111:27: note: '__pstl::execution::v1::par' declared here
  111 | constexpr parallel_policy par{};
      |                           ^~~
split.cpp: In function 'int find_centroid(int)':
split.cpp:88:5: error: 'depth' was not declared in this scope
   88 |     depth[0] = 0;
      |     ^~~~~
split.cpp:93:13: error: 'subsize' was not declared in this scope; did you mean 'size'?
   93 |         if (subsize[i] >= (n + 1) / 2 && depth[i] > depth[cen]) {
      |             ^~~~~~~
      |             size
split.cpp: In function 'void recolor(int, int, int, int, unsigned int, std::vector<int>&)':
split.cpp:119:9: error: 'used' was not declared in this scope
  119 |         used[0][i] = false;
      |         ^~~~
split.cpp:120:19: error: 'col' was not declared in this scope; did you mean 'cosl'?
  120 |      if ((mask >> col[i]) & 1) {
      |                   ^~~
      |                   cosl
split.cpp:126:5: error: 'used' was not declared in this scope
  126 |     used[0][stp] = true;
      |     ^~~~
split.cpp:138:22: error: 'vertex' was not declared in this scope
  138 |         for (int e : vertex[v]) {
      |                      ^~~~~~
split.cpp:139:42: error: 'col' was not declared in this scope; did you mean 'cosl'?
  139 |             if (!used[0][e] && ((mask >> col[e]) & 1)) {
      |                                          ^~~
      |                                          cosl
split.cpp: In function 'void run_parallel_bfs(int, const std::vector<int>&)':
split.cpp:149:9: error: 'col' was not declared in this scope; did you mean 'cosl'?
  149 |         col[i] = -1;
      |         ^~~
      |         cosl
split.cpp:156:13: error: 'used' was not declared in this scope
  156 |             used[i][j] = false;
      |             ^~~~
split.cpp:162:9: error: 'used' was not declared in this scope
  162 |         used[i][nodes[i]] = true;
      |         ^~~~
split.cpp:174:21: error: 'col' was not declared in this scope; did you mean 'cosl'?
  174 |                 if (col[cur] != -1) {
      |                     ^~~
      |                     cosl
split.cpp:184:13: error: 'col' was not declared in this scope; did you mean 'cosl'?
  184 |             col[cur] = i;
      |             ^~~
      |             cosl
split.cpp:188:26: error: 'vertex' was not declared in this scope
  188 |             for (int e : vertex[cur]) {
      |                          ^~~~~~
split.cpp:189:22: error: 'used' was not declared in this scope
  189 |                 if (!used[i][e] && col[e] == -1) {
      |                      ^~~~
split.cpp:203:6: error: 'col' was not declared in this scope; did you mean 'cosl'?
  203 |      col[cur] = magic - 1;
      |      ^~~
      |      cosl
split.cpp:204:19: error: 'vertex' was not declared in this scope
  204 |      for (int e : vertex[cur]) {
      |                   ^~~~~~
split.cpp: In function 'void build_colors_graph(int, int)':
split.cpp:225:22: error: 'vertex' was not declared in this scope
  225 |         for (int e : vertex[i]) {
      |                      ^~~~~~
split.cpp:226:17: error: 'col' was not declared in this scope; did you mean 'cosl'?
  226 |             way[col[i]] |= (1u << col[e]);
      |                 ^~~
      |                 cosl
split.cpp: In function 'std::vector<int> try_random_bfs(int, int, int, int, int)':
split.cpp:291:24: error: 'vertex' was not declared in this scope
  291 |         random_shuffle(vertex[i].begin(), vertex[i].end());
      |                        ^~~~~~
split.cpp:316:16: error: 'col' was not declared in this scope; did you mean 'cosl'?
  316 |         colcnt[col[i]]++;
      |                ^~~
      |                cosl
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:366:9: error: 'vertex' was not declared in this scope
  366 |         vertex[i].clear();
      |         ^~~~~~
split.cpp:370:9: error: 'vertex' was not declared in this scope
  370 |         vertex[p[i]].pb(q[i]);
      |         ^~~~~~