Skip to content

Commit a06f54f

Browse files
committed
[Week02] BOJ: 상자넣기
1 parent 2020c85 commit a06f54f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <iostream>
2+
#include <algorithm>
3+
4+
using namespace std;
5+
6+
int n, len, num;
7+
int lis[1001];
8+
int main() {
9+
ios_base::sync_with_stdio(false);
10+
cin.tie(NULL);
11+
cout.tie(NULL);
12+
13+
cin >> n;
14+
15+
for (int i = 0; i < n; i++) {
16+
cin >> num;
17+
auto lowerPos = lower_bound(lis, lis + len, num);
18+
if (*lowerPos == 0) {
19+
len++;
20+
}
21+
*lowerPos = num;
22+
}
23+
24+
cout << len << '\n';
25+
return 0;
26+
}

0 commit comments

Comments
 (0)