This documentation is automatically generated by online-judge-tools/verification-helper
// #define PROBLEM "https://atcoder.jp/contests/abc222/tasks/abc270_g"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/1/ITP1_1_A"
/*
* AtCoder Beginner Contest 270 G - Sequence in mod P
* https://atcoder.jp/contests/abc270/submissions/68673492
*/
#include "../../Src/Algebra/Monoid/MonoidDiscreteLogarithm.hpp"
#include "../../Src/Algebra/Monoid/AffineMonoid.hpp"
#include "atcoder/modint"
#include <iostream>
#include <utility>
using namespace std;
using namespace zawa;
using mint = atcoder::modint;
struct X : public AffineMonoid<mint> {
using super = AffineMonoid<mint>;
static mint action(super::Element f, mint x) {
return f(x);
}
};
struct Hasher {
size_t operator()(const mint& v) const {
return v.val();
}
};
long long P, A, B, S, G;
long long solve() {
mint::set_mod(P);
auto ans = MonoidDiscreteLogarithm<X, mint, Hasher>(Affine<mint>{A, B}, mint{S}, mint{G}, P);
if (ans)
return ans.value();
else
return -1;
}
int main() {
#ifdef ATCODER
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
int T;
cin >> T;
while (T--) {
cin >> P >> A >> B >> S >> G;
cout << solve() << '\n';
}
#else
cout << "Hello World\n";
#endif
}
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/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.13.7/x64/lib/python3.13/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
bundler.update(path)
~~~~~~~~~~~~~~^^^^^^
File "/opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/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.13.7/x64/lib/python3.13/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 260, in _resolve
raise BundleErrorAt(path, -1, "no such header")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: atcoder/modint: line -1: no such header