| 1 | |
| 2 | pair<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 | |
| 20 | void test() { |
| 21 | check(3, 2, 6); |
no test coverage detected