library

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

View the Project on GitHub beet-aizu/library

:heavy_check_mark: mod/order.cpp

Depends on

Verified with

Code

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

#define call_from_test
#include "pow.cpp"
#undef call_from_test

#endif
//BEGIN CUT HERE
// mod can be composite numbers
template<typename T>
T order(T x,const T MOD){
  static map<T, vector<T>> dp;
  static map<T, T> phi;

  vector<T> &ps=dp[MOD];
  if(ps.empty()){
    T res=MOD,n=MOD;
    for(T i=2;i*i<=n;i++){
      if(n%i) continue;
      while(n%i==0) n/=i;
      res=res/i*(i-1);
    }
    if(n!=1) res=res/n*(n-1);
    phi[MOD]=res;

    for(T i=2;i*i<=res;i++){
      if(res%i) continue;
      while(res%i==0) res/=i;
      ps.emplace_back(i);
    }
    if(res!=1) ps.emplace_back(res);
  }

  T res=phi[MOD];
  for(T p:ps){
    while(res%p==0){
      if(mod_pow(x,res/p,MOD)!=1) break;
      res/=p;
    }
  }
  return res;
}
//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: mod/order.cpp: line 6: unable to process #include in #if / #ifdef / #ifndef other than include guards
Back to top page