algo

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

View the Project on GitHub kuhaku-space/algo

:heavy_check_mark: test/aoj/jag/hopcroft_karp.test.cpp

Depends on

Code

// competitive-verifier: PROBLEM https://onlinejudge.u-aizu.ac.jp/problems/2251
#include "flow/hopcroft_karp.hpp"
#include <algorithm>
#include <iostream>
#include "graph/floyd_warshall.hpp"
#include "graph/matrix_graph.hpp"

int main(void) {
    while (true) {
        int n, m, l;
        std::cin >> n >> m >> l;
        if (!n) break;
        matrix_graph<int> g(n, Inf);
        while (m--) {
            int u, v, w;
            std::cin >> u >> v >> w;
            g.add_edges(u, v, w);
        }
        floyd_warshall(g);
        std::vector<std::pair<int, int>> q(l);
        for (auto &[a, b] : q) std::cin >> a >> b;
        std::sort(q.begin(), q.end(), [](auto l, auto r) { return l.second < r.second; });
        hopcroft_karp hk(l, l);
        for (int i = 0; i < l; ++i) {
            auto [a, b] = q[i];
            for (int j = i + 1; j < l; ++j) {
                auto [c, d] = q[j];
                if (b + g[a][c] <= d) hk.add_edge(i, j);
            }
        }
        std::cout << l - hk.matching() << '\n';
    }

    return 0;
}
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/resolver.py", line 291, in resolve
    bundled_code = language.bundle(path, basedir=basedir)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus.py", line 242, in bundle
    bundler.update(path)
  File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 479, in update
    self._resolve(pathlib.Path(included), included_from=path)
  File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 286, in _resolve
    raise BundleErrorAt(path, -1, "no such header")
competitive_verifier.oj.verify.languages.cplusplus_bundle.BundleErrorAt: flow/hopcroft_karp.hpp: line -1: no such header

Test cases

Env Name Status Elapsed Memory
g++ judge_data :heavy_check_mark: AC 54 ms 6 MB
Back to top page