1
0
Fork 0

fix(template): wrong upper bound for binary search

This commit is contained in:
arielherself 2025-01-10 16:13:33 +08:00
parent dfd419ac95
commit 29ae86a934
Signed by: arielherself
SSH Key Fingerprint: SHA256:AK3cyo9tFsp7Mox7K0sYphleC8hReXhnRKxwuDT5LBc
1 changed files with 1 additions and 1 deletions

View File

@ -296,7 +296,7 @@ ll qpow(ll b, ll p, ll mod) {
#pragma GCC diagnostic ignored "-Wparentheses"
// Accurately find `i` 'th root of `n` (taking the floor)
inline ll root(ll n, ll i) {
ll l = 0, r = pow(LLONG_MAX, (long double)(1) / i);
ll l = 0, r = pow(INFLL, (long double)(1) / i);
while (l < r) {
ll mid = l + r + 1 >> 1;
if (qpow<int128>(mid, i) <= n) {