2.4 Ryn Blackwood’s Adventure: Chamber of Secrets
After surviving the Corridor of Echoes, Ryn Blackwood unlocks the ancient vault to Chamber of Secrets. Exploring, Ryn finds a row of glowing rune-stones that together form an inscription sequence. Opposite them, a target inscription shimmers: Ryn must match this pattern to activate the hidden doorway to Hallway of Gold.
The chamber permits only one kind of ancient rite, the Mirror-Binding Ritual:
- For any rune i, Ryn may perform this ritual on that rune at most once.
- When Ryn performs the ritual on a rune at position i, the rune at that position is replaced with XOR of the number and number at the next position (i+1).
- Ryn may choose any runes and perform their rituals in any order. However, once a rune has been transformed by the Mirror-Binding Ritual, that rune cannot be changed by the same ritual again.
Help Ryn find if the door can be ACTIVATED or is forever SEALED.
Constraints
1<=n<=10^5
0≤ai<2.10^30
0≤bi<2.10^30
Input Format
The first line contains an integer t — the number of test cases
Each test case contains three lines:
Integer n signifying the number of runes
Array a signifying the inscription to be changed
Array b signifying the target inscription
Output Format
String “ACTIVATED” if Ryn can unlock the door, otherwise “SEALED”
Example 1
Input:
2
5
1 2 3 4 5
3 2 7 1 5
3
0 0 1
1 0 1
Output:
ACTIVATED
SEALED
Explanation:
In test case 1, Ryn can act as follows:
She works on the third rune, combining it with the one to its right. The sequence becomes [1, 2, 7, 4, 5].
Then she turns to the fourth rune, shaping it with its neighbor. The sequence becomes [1, 2, 7, 1, 5].
Lastly, she chooses the first rune, binding it with the second. The sequence becomes [3, 2, 7, 1, 5].
In test case 2, it is not possible to reach the target sequence.
Log In to solve the Question