cpp_lib

This documentation is automatically generated by competitive-verifier/competitive-verifier

View the Project on GitHub idat50me/cpp_lib

:warning: Submission page (test/atc_abc291_ex.cpp)

Submission page

Depends on

Code

// competitive-verifier: PROBLEM https://atcoder.jp/contests/abc291/tasks/abc291_h
// competitive-verifier: IGNORE
// to download testcases fails due to some problem

#ifndef call_include
#define call_include
#include <bits/stdc++.h>
using namespace std;
#endif

#include "graph/centroid_decomposition.cpp"

int main() {
	int N;
	v2d<int> E;
	vector<int> ans;

	cin >> N;
	for(int i = 0; i < N - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		E[a].emplace_back(b);
		E[b].emplace_back(a);
	}
	ans.resize(N);

	auto cd = centroid_decomposition(E);
	queue<tuple<int, int, int>> q;
	q.emplace(0, N, -1);
	while(not q.empty()) {
		auto [x, xs, par] = q.front();
		q.pop();

		auto [cent, v] = cd.get(x, xs);
		ans[cent] = par;
		cd.del(cent);
		for(int i = 0; i < v.size(); i++) {
			q.emplace(v[i].first, v[i].second, cent + 1);
		}
	}

	for(int i = 0; i < N; i++) cout << ans[i] << (i == N - 1 ? '\n' : ' ');
}
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/competitive_verifier/oj_resolve/resolver.py", line 181, in resolve
    bundled_code = language.bundle(path, basedir=basedir)
  File "/home/runner/.local/lib/python3.10/site-packages/competitive_verifier/oj/verify/languages/cplusplus.py", line 252, in bundle
    bundler.update(path)
  File "/home/runner/.local/lib/python3.10/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 422, in update
    raise BundleErrorAt(
competitive_verifier.oj.verify.languages.cplusplus_bundle.BundleErrorAt: test/atc_abc291_ex.cpp: line 11: found codes out of include guard
Back to top page