Skip to content

Commit 14d62e7

Browse files
committed
fix north_east_lattice_paths.hpp
1 parent fa1774c commit 14d62e7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

other_algorithms/north_east_lattice_paths.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ NorthEastLatticePathsBothBounded(const std::vector<int> &lb, const std::vector<i
181181
std::vector<MODINT> dp_left = left;
182182
std::vector<int> tmp_ub;
183183
while (true) {
184+
if (x + 1 < n and lb[x + 1] >= ub[x]) {
185+
return std::vector<MODINT>(ub.back() - lb.back());
186+
}
184187
dp_left.resize(ub[x] - lb[x], MODINT{0});
185188

186189
const int x1 = std::upper_bound(ub.begin() + x + 1, ub.begin() + n, ub[x]) - ub.begin();

0 commit comments

Comments
 (0)