library

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

View the Project on GitHub beet-aizu/library

:heavy_check_mark: test/aoj/2971.test.cpp

Depends on

Code

// verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2971

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

#define call_from_test
#include "../../tools/drop.cpp"
#include "../../mod/mint.cpp"
#include "../../polynomial/hash.cpp"
#undef call_from_test

const int MOD1 = 1e9+7;
const int MOD2 = 1e9+9;
const int MOD3 = 1e9+21;

using M1 = Mint<int, MOD1>;
using M2 = Mint<int, MOD2>;
using M3 = Mint<int, MOD3>;

using PH = PolynomialHash<int, M1, M2, M3>;
PH ph(1);

const int MAX = 1e5+100;
int used[MAX]={};
vector<PH::V> vs(MAX,0);

using P = pair<int, int>;
vector<P> G[MAX],R[MAX];

template<typename T> void check(T x,T y){if(x!=y) drop("No");};

void dfs(int v){
  for(auto e:G[v]){
    int u=e.first,x=e.second;
    if(used[u]) continue;
    used[u]=1;
    vs[u]=vs[v]*PH::V(x);
    dfs(u);
  }
  for(auto e:R[v]){
    int u=e.first,x=e.second;
    if(used[u]) continue;
    used[u]=1;
    vs[u]=vs[v]/PH::V(x);
    dfs(u);
  }

  for(auto e:G[v]){
    int u=e.first,x=e.second;
    check(vs[u],vs[v]*PH::V(x));
  }
  for(auto e:R[v]){
    int u=e.first,x=e.second;
    check(vs[u],vs[v]/PH::V(x));
  }
}

signed main(){
  int n,m;
  cin>>n>>m;

  for(int i=0;i<m;i++){
    int a,b,x;
    cin>>a>>b>>x;
    a--;b--;
    G[a].emplace_back(b,x);
    R[b].emplace_back(a,x);
  }

  for(int i=0;i<n;i++){
    if(used[i]) continue;
    vs[i]=PH::V(1);
    dfs(i);
  }

  cout<<"Yes"<<endl;
  return 0;
}
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 401, in update
    self.update(self._resolve(pathlib.Path(included), included_from=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: polynomial/hash.cpp: line 6: unable to process #include in #if / #ifdef / #ifndef other than include guards
Back to top page