#P7852. 「EZEC-9」Yet Another Easy Problem

「EZEC-9」Yet Another Easy Problem

Description

Given n,mn, m, you need to output a permutation of length nn such that, among all permutations that can be obtained from it using at most mm operations, the minimum lexicographic order is as large as possible.

One operation is defined as swapping two numbers in the permutation.

If there are multiple permutations that satisfy the requirement, you may output any one of them.

Input Format

This problem has multiple test cases.

The first line contains a positive integer TT, denoting the number of test cases.

For each test case, one line contains 22 integers n,mn, m.

Output Format

For each test case:

Output one line with nn positive integers, representing the permutation you construct.

2
4 2
3 3

4 3 1 2
1 2 3

Hint

[Sample 11 Explanation]

The operation sequence that makes the lexicographic order smallest is:

4 3 1 21 3 4 21 2 4 34\ 3\ 1\ 2\to1\ 3\ 4\ 2\to1\ 2\ 4\ 3.

It can be proven that a smaller lexicographic order cannot be obtained, and that other initial permutations cannot achieve a larger minimum lexicographic order.

[Sample 22 Explanation]

Obviously, any permutation can be obtained through operations, so you can output any permutation of length 33.

[Constraints]

This problem uses bundled testdata.

  • Subtask 1 (10 points): m=0m = 0.
  • Subtask 2 (10 points): mn1m \ge n - 1.
  • Subtask 3 (25 points): m=1m = 1.
  • Subtask 4 (25 points): T100T \le 100, n6n \le 6.
  • Subtask 5 (30 points): no special constraints.

For 100%100\% of the testdata, 1T1051 \le T \le 10^5, 1n1051 \le n \le 10^5, 0mn0 \le m \le n, n105\sum n \le 10^5.

Translated by ChatGPT 5