icpc-snippet

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

View the Project on GitHub EarthMessenger/icpc-snippet

:heavy_check_mark: verify/graph/scc.test.cpp

Depends on

Code

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

#include "lib/graph/scc.hpp"
#include "lib/internal.hpp"

int main()
{
  int n, m;
  std::cin >> n >> m;
  scc_graph g(n);

  for (int i = 0; i < m; i++) {
    int u, v;
    std::cin >> u >> v;
    g.add_edge(u, v);
  }

  auto [scc_cnt, belongs] = g.solve();

  std::vector<std::vector<int>> groups(scc_cnt);
  for (int i = 0; i < n; i++) {
    groups[belongs[i]].emplace_back(i);
  }
  std::reverse(groups.begin(), groups.end());

  std::cout << groups.size() << std::endl;
  for (auto i : groups) {
    std::cout << i.size() << " ";
    for (auto j : i) {
      std::cout << j << " ";
    }
    std::cout << std::endl;
  }
}
Traceback (most recent call last):
  File "/home/runner/.local/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 "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
    bundler.update(path)
  File "/home/runner/.local/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 "/home/runner/.local/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 "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 312, in update
    raise BundleErrorAt(path, i + 1, "#pragma once found in a non-first line")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: lib/internal.hpp: line 4: #pragma once found in a non-first line
Back to top page