QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 1024 MB 満点: 100

#1820. 競賽建構

統計

ICPC NAC 的工作人員編寫了許多題目,並希望從中挑選題目組成一個題組。每道題目都有一個正整數難度評級。

如果一個競賽的題目難度在排序後,從第三道題目開始,每一道題目的難度都小於或等於其前兩道題目難度之和,則稱該競賽具有「Nice」的難度分佈。

給定一組題目的難度評級以及希望組成的題組題目數量,請計算有多少種具有「Nice」難度分佈的題組。若兩個題組中存在某個題目屬於其中一個題組但不屬於另一個,則視為不同的題組。(特別注意,即使題目順序不同,只要包含的題目相同,仍視為同一個題組。)

輸入格式

輸入的第一行包含兩個整數 $n$ ($3 \le n \le 50$) 和 $k$ ($3 \le k \le 18, k \le n$),其中 $n$ 是裁判編寫的題目總數,$k$ 是他們希望放入題組中的題目數量。

接下來的 $n$ 行,每行包含一個整數 $d$ ($1 \le d \le 10^9$),代表題目的難度。

輸出格式

輸出一個整數,代表具有「Nice」難度分佈的可能題組數量。

範例

範例輸入 1

5 4
2
1
4
3
5

範例輸出 1

4

範例輸入 2

8 5
1
2
3
5
8
13
21
34

範例輸出 2

4

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.