GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Monday, 8 August 2022

[Solution] Lost Array Codeforces Solution




F. Lost Array
time limit per test
1 second
memory limit per test
25

a (1-indexed) of length n that contains information about the world and life. After that, he decided to convert it into the matrix b (0-indexed) of size (n+1)×(n+1) which contains information about the world, life and beyond.

Spyofgame converted a into b with the following rules.

  • bi,0=0 if 0≤i≤n;
  • b0,i=ai if 1≤i≤n;
  • bi,j=bi,j−1⊕bi−1,j if 1≤i,j≤n.

Here ⊕ denotes the bitwise XOR operation.

Today, archaeologists have discovered the famous matrix b. However, many elements of the matrix has been lost. They only know the values of bi,n for 1≤i≤n (note that these are some elements of the last column, not the last row).

Solution Click Below:-  👉CLICK HERE👈

👇👇👇👇👇

 occupied

The archaeologists want to know what a possible array of a is. Can you help them reconstruct any array that could be a?

Input

The first line contains a single integer n (1≤n≤5⋅105).

The second line contains n integers b1,n,b2,n,…,bn,n (0≤bi,n<230).

Output

If some array a is consistent with the information, print a line containing n integers a1,a2,…,an. If there are multiple solutions, output any.

If such an array does not exist, output −1 instead.

No comments:

Post a Comment