Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions weekly/week02/BOJ_1965_상자넣기/Hexeong.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Created by hex on 26. 1. 19..
//

#include <iostream>
#include <vector>

using namespace std;

int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);

int n; cin >> n;
vector<int> arr(n);
vector<int> 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;
}