library

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

View the Project on GitHub beet-aizu/library

:heavy_check_mark: 最大二品種流
(maxflow/twocommodity.cpp)

解説記事

多品種流の話

Depends on

Verified with

Code

#ifndef call_from_test
#include <bits/stdc++.h>
using namespace std;

#define call_from_test
#include "./dinic.cpp"
#undef call_from_test

#endif
//BEGIN CUT HERE
template<typename Flow, bool directed>
struct TwoCommodity{
  Dinic<Flow, directed> G,H;
  int S,T;
  TwoCommodity(int n):G(n+2),H(n+2),S(n),T(n+1){}

  void add_edge(int src,int dst,Flow cap){
    G.add_edge(src,dst,cap);
    H.add_edge(src,dst,cap);
  }

  // maximize sum of two flows (s -> t) and (u -> v)
  Flow build(int s,int t,int u,int v){
    const Flow INF = numeric_limits<Flow>::max()/4;

    G.add_edge(S,s,INF);
    G.add_edge(S,u,INF);
    G.add_edge(t,T,INF);
    G.add_edge(v,T,INF);

    H.add_edge(S,s,INF);
    H.add_edge(S,v,INF);
    H.add_edge(t,T,INF);
    H.add_edge(u,T,INF);

    return min(G.flow(S,T),H.flow(S,T));
  }
};
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
signed main(){
  return 0;
}
#endif
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/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.11.3/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
    bundler.update(path)
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 400, in update
    raise BundleErrorAt(path, i + 1, "unable to process #include in #if / #ifdef / #ifndef other than include guards")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: maxflow/twocommodity.cpp: line 6: unable to process #include in #if / #ifdef / #ifndef other than include guards
Back to top page