QOJ.ac

QOJ

حد الوقت: 2.0 s حد الذاكرة: 1024 MB مجموع النقاط: 100 قابلة للهجوم ✓

#15220. Sequence II

الإحصائيات

oql thought of a problem.

Given a sequence $a$ of length $n$. The value of an interval $[l, r]$ is defined as: $$\max(a_l, a_{l+1}, \dots, a_r) \times \min(a_l, a_{l+1}, \dots, a_r) \times (r - l + 1)$$

What is the $k$-th largest interval value?

Input

The first line contains two space-separated integers $n, k$ ($1 \le n \le 5 \times 10^4, 1 \le k \le \frac{n(n + 1)}{2}$), representing the length of the sequence and the query parameter, respectively.

The second line contains $n$ space-separated positive integers, where the $i$-th number represents the value of $a_i$ ($1 \le a_i \le 5 \times 10^4$).

Output

Output a single line containing one positive integer, representing the $k$-th largest interval value.

Examples

Input 1

8 7
1 3 5 6 7 2 4 5

Output 1

70

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.