問題一覧 > 通常問題

No.3188 K-th Lexmin

レベル : / AI推定難易度 : 2225 / 実行時間制限 : 1ケース 3.500秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 21
作問者 : 蜜蜂 / テスター : Mitarushi
お気に入りにしたユーザー ProblemId : 12381 / 自分の提出
問題文最終更新日: 2025-06-21 18:44:36
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 471 (順位表) の他の問題:

Problem Statement

You are given a sequence of non-negative integers $A = (A_1, A_2, \cdots, A_N)$ of length $N$.
$A$ has $\frac{N(N + 1)}{2}$ contiguous subarrays. When they are arranged in lexicographic order, output the contiguous subarray at the $K$-th position.

You are given $T$ test cases; find the answer for each of them.

Input

$T$
$\mathrm{case}_1$
$\mathrm{case}_2$
$\vdots$
$\mathrm{case}_T$
Here, $\mathrm{case}_i$ denotes the $i$-th test case, and each test case is given in the following format.
$N\ \ K$
$A_1\ \ A_2\ \ \cdots A_N$

  • $1 \leq T \leq 10^5$
  • $1 \leq N \leq 2 \times 10^5$
  • $1 \leq K \leq \frac{N(N + 1)}{2}$
  • $1 \leq A_i \leq N$
  • All input values are integers.
  • In $1$ input file, the sum of $N$ does not exceed $5 \times 10^5$.

Output

For each test case, output the contiguous subarray at the $K$-th position in lexicographic order, separated by spaces, followed by a newline.

Sample

Sample 1
Input
3
3 4
2 1 2
4 4
1 2 3 4
17 100
12 3 6 5 6 11 13 1 2 8 2 13 1 14 1 8 7
Output
2
1 2 3 4
8 2 13 1 14 1

For the $1$-st test case, the contiguous subarrays of $A$ are the following $6$: $(2), (2, 1), (2, 1, 2), (1), (1, 2), (2)$. Arranged in lexicographic order, they are $(1), (1, 2), (2), (2), (2, 1), (2, 1, 2)$. The $4$-th of these is $(2)$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。