https://www.acmicpc.net/problem/11054
#include <iostream>
using namespace std;
int len, seq[1000], L[1000], increase[1000], decrease[1001];
int main()
{
cin.tie(0)->sync_with_stdio(0);
int N;
cin >> N;
for(int i = 0; i < N; i++) {
cin >> seq[i];
auto pos = lower_bound(L, L + len, seq[i]);
*pos = seq[i];
if(pos == L + len) len++;
increase[i] = len;
}
int L[1000] = {};
len = 0;
for(int i = N-1; i >= 0; i--) {
auto pos = lower_bound(L, L + len, seq[i]);
*pos = seq[i];
if(pos == L + len) len++;
decrease[i] = len;
}
int max_len = 0;
for(int i = 0; i < N; i++) {
if(seq[i] == seq[i+1]) continue;
max_len = max(max_len, increase[i] + decrease[i+1]);
}
cout << max_len;
}
2시간 동안 고민해도 뭐가 틀린지 모르겠네
해당 댓글은 삭제되었습니다.
모바일임여 ??
찾아주새오 ...
lis냐
맞음여
모르겠으십니까 ㅠㅠㅠ
찾았는데 댓글로 적기엔 공간이 적네 어쩔 수 없는 듯 ㅅㄱ
ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ 살려주새요
선생님 제발여
뭐하는 코드인지는 알려줘야지
링크잇구나
넴 ;ㅅ;
못찾으심여 ? ㅠㅠ
나 알아냄 500원 주면 알려줄게 ㅋㅋ
게쟈 불러주새요