From 578e2b9471f37119c49963998b7568a86904e918 Mon Sep 17 00:00:00 2001 From: Hexeong <123macanic@naver.com> Date: Mon, 19 Jan 2026 22:57:59 +0900 Subject: [PATCH] =?UTF-8?q?[Week2]=20BOJ=201965:=20=EC=83=81=EC=9E=90?= =?UTF-8?q?=EB=84=A3=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Hexeong.cpp" | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 "weekly/week02/BOJ_1965_\354\203\201\354\236\220\353\204\243\352\270\260/Hexeong.cpp" diff --git "a/weekly/week02/BOJ_1965_\354\203\201\354\236\220\353\204\243\352\270\260/Hexeong.cpp" "b/weekly/week02/BOJ_1965_\354\203\201\354\236\220\353\204\243\352\270\260/Hexeong.cpp" new file mode 100644 index 0000000..d3d0450 --- /dev/null +++ "b/weekly/week02/BOJ_1965_\354\203\201\354\236\220\353\204\243\352\270\260/Hexeong.cpp" @@ -0,0 +1,35 @@ +// +// Created by hex on 26. 1. 19.. +// + +#include +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(false); + cin.tie(nullptr); + cout.tie(nullptr); + + int n; cin >> n; + vector arr(n); + vector dp(n, 1); + + for (int i = 0; i < n; i++) + cin >> arr[i]; + + int max_v = 1; + for (int i = 0; i < n; i++) { + for (int j = 0; j < i; j++) { + if (arr[j] < arr[i]) { + dp[i] = max(dp[i], dp[j] + 1); + } + } + max_v = max(max_v, dp[i]); + } + + cout << max_v << endl; + + return 0; +} \ No newline at end of file