This documentation is automatically generated by online-judge-tools/verification-helper
#include "z_other/longest_increasing_subsequences.hpp"longest_increasing_subsequences<bool is_strict, T>(vector<T> v) : $v$ の最長増加部分列の長さを返す。
is_strict = true の時、狭義単調増加is_strict = false の時、講義単調増加#pragma once
#include<algorithm>
#include<vector>
template <bool is_strict, class T>
int longest_increasing_subsequences(const std::vector<T>& v){
std::vector<T> dp;
auto it = dp.begin();
for(auto elem : v){
if constexpr (is_strict){
it = std::lower_bound(dp.begin(), dp.end(), elem);
}else{
it = std::upper_bound(dp.begin(), dp.end(), elem);
}
if(it == dp.end()){
dp.push_back(elem);
}else{
*it = elem;
}
}
return int(dp.size());
}#line 2 "z_other/longest_increasing_subsequences.hpp"
#include<algorithm>
#include<vector>
template <bool is_strict, class T>
int longest_increasing_subsequences(const std::vector<T>& v){
std::vector<T> dp;
auto it = dp.begin();
for(auto elem : v){
if constexpr (is_strict){
it = std::lower_bound(dp.begin(), dp.end(), elem);
}else{
it = std::upper_bound(dp.begin(), dp.end(), elem);
}
if(it == dp.end()){
dp.push_back(elem);
}else{
*it = elem;
}
}
return int(dp.size());
}