8000 Update 7570.cpp · urijan44/basic-algo-lecture@f284057 · GitHub
[go: up one dir, main page]

Skip to content

Commit f284057

Browse files
authored
Update 7570.cpp
1 parent 1a83c53 commit f284057

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

0x11/solutions/7570.cpp

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
1-
// Authored by : BaaaaaaaaaaarkingDog
1+
// Authored by : unluckyjung
22
// Co-authored by : -
3-
// http://boj.kr/****************
3+
// http://boj.kr/d3653e0ab40644c29b02d67ec754f8d1
44
#include <bits/stdc++.h>
5+
56
using namespace std;
67

7-
int main(void){
8-
ios::sync_with_stdio(0);
8+
const int MAX = 1e6 + 2;
9+
10+
int dp[MAX];
11+
int studentCount, studentNumber;
12+
int chainMaxLIS;
13+
14+
int main() {
15+
ios_base::sync_with_stdio(false);
916
cin.tie(0);
1017

11-
}
18+
cin >> studentCount;
19+
20+
for (int i = 0; i < studentCount; ++i) {
21+
cin >> studentNumber;
22+
dp[studentNumber] = dp[studentNumber - 1] + 1;
23+
chainMaxLIS = max(chainMaxLIS, dp[studentNumber]);
24+
}
25+
26+
cout << studentCount - chainMaxLIS << "\n";
27+
28+
return 0;
29+
}

0 commit comments

Comments
 (0)
0