MCPcopy Create free account
hub / github.com/Seogeurim/CS-study / main

Function main

contents/algorithm/code/lis_bs.cpp:13–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11}
12
13int main(){
14 int n,idx=1;
15 cin >> n;
16 for(int i=0;i<n;i++) scanf("%d",&arr[i]);
17 ans[0] = arr[0];
18 for(int i=0;i<n;i++){
19 if(arr[i]>ans[idx-1]){
20 ans[idx++] = arr[i];
21 }
22 else{
23 int a = bs(0,idx-1,arr[i]);
24 ans[a] = arr[i];
25 }
26 }
27 cout << idx;
28
29 return 0;
30}

Callers

nothing calls this directly

Calls 1

bsFunction · 0.85

Tested by

no test coverage detected