From 5de2ef354fa9fbb4895f83cf0ded0330d63bd3e9 Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Wed, 13 Nov 2024 22:37:54 +0800 Subject: [PATCH] update --- src/B3637/B3637.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/B3637/B3637.cpp diff --git a/src/B3637/B3637.cpp b/src/B3637/B3637.cpp new file mode 100644 index 0000000..72920d8 --- /dev/null +++ b/src/B3637/B3637.cpp @@ -0,0 +1,31 @@ +#include +#include +#include +#include + +using ll = int; + +// const ll max_n = (ll)1e6+5; +// ll a[max_n], f[max_n]; + +int main(){ + std::iostream::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr); + ll n; + std::cin>>n; + const ll max_n = (ll)5e3+5; + ll *a = new ll[max_n], *f = new ll[max_n]; + for(ll i{1};i<=n;i++){ + std::cin>>a[i]; + } + std::fill(f, f+max_n, 1); + ll max{}; + for(ll i{2};i<=n;i++){ + for(ll j{1};ja[j]){ + f[i] = std::max(f[i], f[j]+1); + } + } + max = std::max(max, f[i]); + } + std::cout<