diff options
Diffstat (limited to 'math/longestIncreasingSubsequence.cpp')
| -rw-r--r-- | math/longestIncreasingSubsequence.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/math/longestIncreasingSubsequence.cpp b/math/longestIncreasingSubsequence.cpp index c2c5f3e..99bb141 100644 --- a/math/longestIncreasingSubsequence.cpp +++ b/math/longestIncreasingSubsequence.cpp @@ -2,7 +2,7 @@ vector<int> lis(vector<int> &seq) { int n = sz(seq), lisLength = 0, lisEnd = 0; vector<int> L(n), L_id(n), parents(n); for (int i = 0; i < n; i++) { - int pos = upper_bound(L.begin(), L.begin() + lisLength, + int pos = upper_bound(L.begin(), L.begin() + lisLength, seq[i]) - L.begin(); L[pos] = seq[i]; L_id[pos] = i; |
