library

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

View the Project on GitHub beet-aizu/library

:heavy_check_mark: tree/mo_on_tree.cpp

Depends on

Verified with

Code

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

#define call_from_test
#include "../algorithm/mo.cpp"
#include "../tree/eulertourforedge.cpp"
#undef call_from_test

#endif
//BEGIN CUT HERE
struct MoOnTree{
  Mo* mo;
  using F = Mo::F;
  EulerTourForEdge et;
  vector<int> app,idx;
  int width;
  F expand,shrink;
  MoOnTree(int n,int width,F expand,F shrink):
    et(n),app(n,0),idx(n),width(width),expand(expand),shrink(shrink){}
  vector<pair<int,int>> es,qs;
  void add_edge(int u,int v){
    es.emplace_back(u,v);
    et.add_edge(u,v);
  }
  void add_query(int u,int v){
    qs.emplace_back(u,v);
  }
  void build(){
    et.build();
    int num=0;
    for(auto[u,v]:es) idx[et.child(u,v)]=num++;
    F exec=[&](int k){
      int v=et.bottom(k);
      int e=idx[v];
      app[v]^=1;
      if(app[v]) expand(e);
      else shrink(e);
    };
    int n=et.G.size();
    mo=new Mo(2*n,width,exec,exec);
    auto f=[&](int l,int r){mo->add(min(l,r),max(l,r));};
    for(auto[u,v]:qs) et.query(u,v,f);
    mo->build();
  }
  int process(){return mo->process();}
};
//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: tree/mo_on_tree.cpp: line 6: unable to process #include in #if / #ifdef / #ifndef other than include guards
Back to top page