update ucpc2026

This commit is contained in:
2026-07-11 09:38:32 +09:00
parent 7176febe54
commit 0b8c2864ae
20 changed files with 329 additions and 163 deletions
+5 -6
View File
@@ -51,7 +51,7 @@ struct Qring : public vl {
}
friend poly operator*(const poly& A, const poly& B) {
poly ret = conv<mod, w>(A, B);
// ACL : poly ret = atcoder::convolution<mod>(A, B);
// poly ret = atcoder::convolution<mod>(A, B); // ACL
return ret.adjust(), ret;
}
friend poly inv(const poly& A, int t) { assert(A[0] != 0);
@@ -89,16 +89,15 @@ struct Qring : public vl {
ll idx = 0; while(ret[idx] == 0) idx++;
if((__int128_t) idx * b >= t) return poly(0, t);
ll c = ret[idx]; ll ic = pow<mod>(ret[idx], mod-2); poly g;
int n = ret.size();
ll c = ret[idx]; ll ic = pow<mod>(ret[idx], mod-2);
poly g; int n = ret.size();
fors(i, idx, n-1) g[i-idx] = ret[i]*ic%mod;
g.resize(t-idx*b);
g = exp(b * log(g, t-idx*b), t-idx*b);
c = pow<mod>(c, b);
ret = poly(0, t); fors(i, idx*b, t-1) ret[i] = g[i-idx*b] * c % mod;
ret = poly(0, t);
fors(i, idx*b, t-1) ret[i] = g[i-idx*b] * c % mod;
return ret;
}