CF597C.Subsequences

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

For the given sequence with n different elements find the number of increasing subsequences with k + 1 elements. It is guaranteed that the answer is not greater than 8·1018.

对于给定的包含 nn 个不同元素的序列,求长度为 k+1k+1 的严格递增子序列的个数。保证答案不超过 8⋅10188 \cdot 10^{18}。

输入格式

First line contain two integer values n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 10) — the length of sequence and the number of elements in increasing subsequences.

Next n lines contains one integer a__i (1 ≤ a__i ≤ n) each — elements of sequence. All values a__i are different.

第一行包含两个整数 nn 和 kk(1≤n≤1051 \leq n \leq 10^5,0≤k≤100 \leq k \leq 10)—— 分别表示序列的长度以及递增子序列中元素的个数。

接下来 nn 行,每行包含一个整数 aia_i(1≤ai≤n1 \leq a_i \leq n)—— 序列的元素。所有 aia_i 的值互不相同。

输出格式

Print one integer — the answer to the problem.

输出一个整数——该问题的答案。

输入输出样例

  • 输入#1

    5 2
    1
    2
    3
    5
    4

    输出#1

    7

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

首页