test/yosupo/other/longest_increasing_subsequence.test.cpp
✅
AC
· 最終更新 2026-09-06
· GitHub
問題: https://judge.yosupo.jp/problem/longest_increasing_subsequence
依存するヘッダ(2)
実装
// competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/longest_increasing_subsequence
#include <iostream>
#include <vector>
#include "string/misc.hpp"
int main(void) {
int n;
std::cin >> n;
std::vector<int> a(n);
for (auto &e : a) std::cin >> e;
auto ans = make_lis(a);
std::cout << ans.size() << '\n';
for (int i = 0; i < (int)ans.size(); ++i) std::cout << ans[i] << (i == (int)ans.size() - 1 ? '\n' : ' ');
return 0;
}