#P9027. [CCC 2021 S5] Math Homework
[CCC 2021 S5] Math Homework
Problem Description
Construct an integer sequence of length such that:
- .
- $\forall i=1,2,\cdots,M, \gcd(A_{X_i},A_{X_i+1},\cdots,A_{Y_i})=Z_i$.
Or report that there is no solution.
Input Format
The first line contains .
The next lines each contain , describing constraint 2.
Output Format
Output one line: the sequence , or Impossible.
2 2
1 2 2
2 2 6
4 6
2 2
1 2 2
2 2 5
Impossible
Hint
$$1\leq N\leq 150000, 1\leq M\leq 150000, 1\leq Z_i\leq 16.$$Translated from CCC2021 S5.
The special judge (spj) is in the attachment. If you find any issues, please contact me.
Translated by ChatGPT 5