fix(template): wrong upper bound for binary search
This commit is contained in:
parent
dfd419ac95
commit
29ae86a934
|
@ -296,7 +296,7 @@ ll qpow(ll b, ll p, ll mod) {
|
||||||
#pragma GCC diagnostic ignored "-Wparentheses"
|
#pragma GCC diagnostic ignored "-Wparentheses"
|
||||||
// Accurately find `i` 'th root of `n` (taking the floor)
|
// Accurately find `i` 'th root of `n` (taking the floor)
|
||||||
inline ll root(ll n, ll i) {
|
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) {
|
while (l < r) {
|
||||||
ll mid = l + r + 1 >> 1;
|
ll mid = l + r + 1 >> 1;
|
||||||
if (qpow<int128>(mid, i) <= n) {
|
if (qpow<int128>(mid, i) <= n) {
|
||||||
|
|
Loading…
Reference in New Issue