Algorithm

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub yosupo06/Algorithm

:heavy_check_mark: src/treedecomp_width2.test.cpp

Depends on

Code

#define PROBLEM "https://judge.yosupo.jp/problem/tree_decomposition_width_2"

#include "base.hpp"
#include "util/fast_io.hpp"
#include "graph/treedecomp.hpp"

int main() {
    Scanner sc(stdin);
    Printer pr(stdout);

    string s;
    sc.read(s, s);
    int n, m;
    sc.read(n, m);
    VV<SimpleEdge> g(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        sc.read(a, b); a--; b--;
        g[a].push_back({b});
        g[b].push_back({a});
    }

    auto td = decomp_width2(g);
    int K = int(td.bags.size());
    if (K == 0) {
        pr.writeln(-1);
        return 0;
    }
    pr.writeln("s", "td", K, 2, n);

    for (int i = 0; i < K; i++) {
        pr.write("b", i + 1);
        for (int j: td.bags[i]) {
            pr.write(' ');
            pr.write(j + 1);
        }
        pr.writeln();
    }
    for (int i = 0; i < K; i++) {
        for (auto e: td.tr[i]) {
            int j = e.to;
            if (i < j) {
                pr.writeln(i + 1, j + 1);
            }
        }
    }
    return 0;
}
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.1/x64/lib/python3.10/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
  File "/opt/hostedtoolcache/Python/3.10.1/x64/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
    bundler.update(path)
  File "/opt/hostedtoolcache/Python/3.10.1/x64/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
    self.update(self._resolve(pathlib.Path(included), included_from=path))
  File "/opt/hostedtoolcache/Python/3.10.1/x64/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
    self.update(self._resolve(pathlib.Path(included), included_from=path))
  File "/opt/hostedtoolcache/Python/3.10.1/x64/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 260, in _resolve
    raise BundleErrorAt(path, -1, "no such header")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: base.hpp: line -1: no such header
Back to top page