测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A9998. Once Again...

编程题 普及/提高-

题目描述

You are given an array of positive integers $a_{1},a_{2},...,a_{n×T}$ of length $n×T$ . We know that for any $i>n$ it is true that $a_{i}=a_{i-n}$ . Find the length of the longest non-decreasing sequence of the given array.

输入格式

The first line contains two space-separated integers: $n$ , $T$ ( $1<=n<=100$ , $1<=T<=10^{7}$ ). The second line contains $n$ space-separated integers $a_{1},a_{2},...,a_{n}$ ( $1<=a_{i}<=300$ ).

输出格式

Print a single number — the length of a sought sequence.

输入输出样例

输入 #1
4 3
3 1 4 2
输出 #1
5

说明/提示

The array given in the sample looks like that: 3, 1, 4, 2, 3, 1, 4, 2, 3, 1, 4, 2. The elements in bold form the largest non-decreasing subsequence.
上一题 去做题 下一题