Skip to content

Commit 6268d6c

Browse files
authored
[20250225] BOJ / G4 / 줄세우기 / 권혁준
1 parent 4565b9a commit 6268d6c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
```cpp
2+
3+
#include <iostream>
4+
#include <algorithm>
5+
using namespace std;
6+
7+
int main()
8+
{
9+
cin.tie(0)->sync_with_stdio(0);
10+
11+
int N, arr[202]{}, dp[202]{}, ans = 0;
12+
cin >> N;
13+
for (int i = 1; i <= N; i++) {
14+
cin >> arr[i];
15+
for (int j = 0; j < i; j++) if (arr[i] > arr[j]) dp[i] = max(dp[i], dp[j] + 1);
16+
ans = max(ans, dp[i]);
17+
}
18+
cout << N - ans;
19+
20+
}
21+
22+
```

0 commit comments

Comments
 (0)