MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / check

Function check

code/mathematics/linear_congruence.test.cpp:2–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1
2pair<ll,ll> check(ll a, ll b, ll c) {
3 pair<ll,ll> res = linear_congruence(a,b,c);
4 vector<ll> x,y;
5 if (res.second != 0) {
6 rep(k,0,c / res.second) {
7 y.push_back(smod(res.first + k * res.second, c));
8 }
9 }
10 sort(y.begin(), y.end());
11 rep(i,0,c) {
12 if (smod(a*i,c) == smod(b,c)) {
13 x.push_back(i);
14 }
15 }
16 assert_true(x == y);
17 return res;
18}
19
20void test() {
21 check(3, 2, 6);

Callers 1

testFunction · 0.70

Calls 4

linear_congruenceFunction · 0.85
smodFunction · 0.85
assert_trueFunction · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected