If you haven't completed the codechef prefixes december long challange then here are some hint given you csn go throught thease statements.
Problem statement
this Problem Positive prefix taken from CodeChef December long challenge.Let's read Problem statement.
You are given two positive integers and , where . Find a sequence such that:
- for each valid , is either or
- there are exactly values of such that and
If there are multiple solutions, you may print any one of them. It can be proved that at least one solution always exists.
Input
- The first line of the input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first and only line of each test case contains two space-separated integers and .
Output
For each test case, print a single line containing space-separated integers .
Constraints
Subtasks
Subtask #1 (10 points):
Subtask #2 (90 points): original constraints
Example Input
3
3 3
Example Output
1 2 3
Resources & hint
n=5 k=1 (k<n/2)so one of the solution could be
o/p- -1 2 -3 -4 -5
n=3 k=3 (print same)
o/p- 1 2 3
n=10 k=6 (k>n/2) so one of the solution could be
o/p- -1 2 -3 4 -5 6 -7 8 -9 10
explanation:
-1+2 >0
-1+2-3+4 >0
-1+2-3+4-5+6 >0
-1+2-3+4-5+6-7+8 >0
-1+2-3+4-5+6-7+8-9 >0
-1+2-3+4-5+6-7+8+9+10 >0
For more hint go -> here
Tags:
Codechef december long challange
codechef solutions
codechef positive prefixes solution
codechef hail xor december long challange solutions
Square root of lca conv december codechef long challange solution
0 Comments