#C2131. Find Strictly Increasing Subsequence

    ID: 45414 Type: Default 1000ms 256MiB

Find Strictly Increasing Subsequence

Find Strictly Increasing Subsequence

You are given an array of integers. Your task is to find any strictly increasing subsequence of at least length 5. A strictly increasing subsequence (a_1, a_2, a_3, a_4, a_5) must satisfy (a_1 < a_2 < a_3 < a_4 < a_5). If such a subsequence exists, output the first found subsequence consisting of 5 elements; otherwise, output "No such subsequence".

inputFormat

The input is given in two lines. The first line contains an integer (n) representing the number of elements. The second line contains (n) space-separated integers.

outputFormat

If a strictly increasing subsequence of at least length 5 exists, print the first found subsequence (exactly 5 integers) separated by a single space. Otherwise, print the string "No such subsequence".## sample

10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5