CF582B.Once Again...

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

给你一个长度为 $ n \times T $ 的正整数数组 $ a_1, a_2, ..., a_{n \times T} $。已知对任意 $ i > n $,都有 $ a_i = a_{i - n} $。求该数组中最长非递减子序列的长度。

输入格式

The first line contains two space-separated integers: n, T (1 ≤ n ≤ 100, 1 ≤ T ≤ 107). The second line contains n space-separated integers _a_1, _a_2, ..., a__n (1 ≤ a__i ≤ 300).

第一行包含两个用空格分隔的整数:nn、TT(1 ≤ n ≤ 1001 ≤ n ≤ 100,1 ≤ T ≤ 1071 ≤ T ≤ 10^7)。第二行包含 nn 个用空格分隔的整数 a1, a2, ..., ana_1, a_2, ..., a_n(1 ≤ ai ≤ 3001 ≤ 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.

样例中给出的数组如下:3, 1, 4, 2, 3, 1, 4, 2, 3, 1, 4, 2。其中加粗的元素构成了最长的非递减子序列。

输入解题思路,AI测评打分。不知道怎么写?

首页