1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <queue>
#include <algorithm>
#include <map>
#include <stack>
#include <vector>
using namespace std;
#define INF 987654321
#define MOD 1000000007
#define P make_pair
typedef long long LL;
typedef unsigned long long UL;
int arr[100001];
int brr[100001],bnt;
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&arr[i]);
for(int i=0;i<n;i++){
if(bnt==0){
brr[bnt++]=arr[i];
}
else{
if(brr[bnt-1]<arr[i]) brr[bnt++]=arr[i];
else{
int change=lower_bound(brr,brr+bnt,arr[i])-brr;
brr[change]=arr[i];
}
}
}
printf("%d",bnt);
return 0;
}
| cs |
2016년 11월 30일 수요일
test3
하이라이터 쓰는법
c++은 특히 꺽쇠가 많다.
그래서 <pre> 쓰기 귀찮? 았었는데
http://colorscripter.com/ 라는 곳을 이용하면 된다
요렇게
그래서 <pre> 쓰기 귀찮? 았었는데
http://colorscripter.com/ 라는 곳을 이용하면 된다
요렇게
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <queue>
#include <algorithm>
#include <map>
#include <stack>
#include <vector>
using namespace std;
#define INF 987654321
#define MOD 1000000007
#define P make_pair
typedef long long LL;
typedef unsigned long long UL;
int arr[100001];
int brr[100001],bnt;
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&arr[i]);
for(int i=0;i<n;i++){
if(bnt==0){
brr[bnt++]=arr[i];
}
else{
if(brr[bnt-1]<arr[i]) brr[bnt++]=arr[i];
else{
int change=lower_bound(brr,brr+bnt,arr[i])-brr;
brr[change]=arr[i];
}
}
}
printf("%d",bnt);
return 0;
}
| cs |
피드 구독하기:
글 (Atom)