CF2247B Yet Another Constructive
Description
You are given three integers $ n $ , $ k $ , and $ m $ .
We call an array $ a $ of length $ n $ , consisting of positive integers, good if the minimum length of a non-empty subarray $ ^{\text{∗}} $ of $ a $ whose sum is divisible by $ m $ equals $ k $ .
Formally, an array $ a $ is good if the following conditions hold:
- there exist integers $ l $ and $ r $ such that $ 1 \le l \le r \le n $ , $ r - l + 1 = k $ , and $ \sum\limits_{i = l}^{r} a_i $ is divisible by $ m $ ;
- there do not exist integers $ l $ and $ r $ such that $ 1 \le l \le r \le n $ , $ r - l + 1 \lt k $ , and $ \sum\limits_{i = l}^{r} a_i $ is divisible by $ m $ .
Find any good array $ a $ , or determine that no such array exists.
$ ^{\text{∗}} $ An array $ a $ is a subarray of an array $ b $ if $ a $ can be obtained from $ b $ by the deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.
Input Format
Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \le t \le 10^4 $ ). The description of the test cases follows.
The only line of each test case contains three integers $ n $ , $ k $ , and $ m $ ( $ 1 \le k \le n \le 2 \cdot 10^5 $ , $ 1 \le m \le 10^9 $ ).
It is guaranteed that the sum of $ n $ over all test cases does not exceed $ 2 \cdot 10^5 $ .
Output Format
For each test case, if an answer exists, output "YES" on the first line. On the second line, output $ n $ integers $ a_1, a_2, \ldots, a_n $ ( $ 1 \le a_i \le 10^{18} $ ) — the array $ a $ satisfying the conditions of the problem. If there are multiple valid solutions, output any of them.
Otherwise, output a single line containing "NO".
You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.
Explanation/Hint
In the first example, one possible solution is $ a = [1] $ . The only non-empty subarray has length $ k = 1 $ , and its sum is divisible by $ m = 1 $ .
In the second example, one possible solution is $ a = [9, 17, 14, 23, 11] $ . The sum of the subarray $ [9, 17, 14] $ is $ 9 + 17 + 14 = 40 $ , which is divisible by $ m = 5 $ . It can be shown that no non-empty subarray with fewer than $ k = 3 $ elements has a sum divisible by $ 5 $ , so this solution is valid.
In the fourth example, it can be shown that no good array $ a $ exists.