목차

포스택

ps
링크acmicpc.net/…
출처BOJ
문제 번호25556
문제명포스택
레벨골드 5
분류

LIS

시간복잡도O(nlogn)
인풋사이즈n<=100,000
사용한 언어Python 3.13
제출기록44672KB / 64ms
최고기록64ms
해결날짜2026/01/22

풀이

코드

"""Solution code for "BOJ 25556. 포스택".

- Problem link: https://www.acmicpc.net/problem/25556
- Solution link: http://www.teferi.net/ps/problems/boj/25556

Tags: [LIS]
"""

from teflib import seqtask


def main():
    _N = int(input())
    A = [int(x) for x in input().split()]

    print('YES' if seqtask.longest_dec_subseq_length(A) <= 4 else 'NO')


if __name__ == '__main__':
    main()