#P11132. 【MX-X5-T4】「GFOI Round 1」epitaxy
【MX-X5-T4】「GFOI Round 1」epitaxy
Background
Original link: https://oier.team/problems/X5E.
Problem Description
You are given two positive integers .
Define the value of a permutation of as the greatest common divisor of the maximum values of all consecutive subarrays of length .
(By definition, the greatest common divisor of a single number is the number itself.)
Please find a permutation of with the maximum value among all such permutations. If there are multiple, output any one.
This problem will use a custom checker to verify whether the permutation you construct is correct, so outputting any permutation with the maximum value will be accepted.
Input Format
This problem has multiple test cases.
The first line contains a positive integer , denoting the number of test cases.
For each test case:
The first line contains two positive integers .
Output Format
For each test case, output one line with positive integers, denoting a permutation that meets the requirement.
This problem will use a custom checker to verify whether the permutation you construct is correct, so outputting any permutation with the maximum value will be accepted.
4
2 2
4 2
7 5
10 3
1 2
1 2 4 3
5 3 6 7 1 2 4
6 3 5 8 1 2 4 10 9 7
Hint
Sample Explanation.
In the first test case, when , the permutation has the maximum value, which is . It can also be proven that when , there is no permutation with value .
In the second test case, when , the permutation has the maximum value, which is , because the maximum values of all subarrays of length are , whose greatest common divisor is . It can also be proven that when , there is no permutation with value .
Constraints.
This problem uses bundled tests and enables subtask dependencies.
| Subtask ID | Special Property | Subtask Dependencies | Score | ||
|---|---|---|---|---|---|
| None | None | ||||
| A | |||||
| B | |||||
| None | |||||
- Special Property A: .
- Special Property B: .
For all testdata, it holds that , , , and .
Translated by ChatGPT 5