Official
C - PORALIS Editorial by evima
Tester's solutionLet \(P~\mathrm{OR}~a = (P_1~\mathrm{OR}~a, P_2~\mathrm{OR}~a, \dots, P_N~\mathrm{OR}~a)\).
\(N=1\)
Set \(P = (0), A=(0)\).
\(N=2\)
Set \(P = (0, 1), A=(1,0)\).
\(N \geq 3\)
Let the solution for \(N = k\) be \(p\) and \(a\), and let \(X\) be the minimum integer satisfying \(\max(p, a) < 2^X\).
For \(N=k+1\), \(P\) and \(A\) should be as follows:
- \(P\) is the sequence obtained by adding \(2^X\) to the end of \(p\)
- \(A\) is the sequence obtained by adding \(2^{X+1}-1\) to the beginning of \(a\)
For \(N = 2k+1\), \(P\) and \(A\) should be as follows:
- \(P\) is the concatenation of \(p\), \(p~\mathrm{OR}~2^X\), and \(2^{X+1}\) in this order
- \(A\) is \((2^{X+2}-1, a_1 + 2^{X+1} , a_1, a_2 + 2^{X+1} , a_2, \dots, a_k + 2^{X+1} , a_k)\)
posted:
last update: