File tree Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change 1
- // Authored by : BaaaaaaaaaaarkingDog
1
+ // Authored by : unluckyjung
2
2
// Co-authored by : -
3
- // http://boj.kr/****************
3
+ // http://boj.kr/d3653e0ab40644c29b02d67ec754f8d1
4
4
#include < bits/stdc++.h>
5
+
5
6
using namespace std ;
6
7
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 );
9
16
cin.tie (0 );
10
17
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
+ }
You can’t perform that action at this time.
0 commit comments