Find XOR SOLUTIONS FINXOR

Find XOR SOLUTION

This is an intelligent issue. 
 
There is an arrangement of positive whole numbers A1,A2,… ,AN. You don’t have a clue about this grouping, however your errand is to discover the estimation of A1⊕A2⊕… ⊕AN, where ⊕ means the bitwise XOR activity. 
 
You may ask up to 20 inquiries. In each question, you ought to pick a whole number K (1≤K≤2⋅106) and the interactor reacts with the estimation of (A1⊕K)+(A2⊕K)+… +(AN⊕K). 
 
Connection 
 
To start with, you should peruse a line containing a solitary whole number T signifying the quantity of experiments. The depiction of cooperation for T experiments follows. 
 
For each experiment, you should begin by perusing a line containing a solitary number N. 
 
To pose an inquiry, you should print a line containing two space-isolated whole numbers 1 and K, where 1≤K≤2⋅106. At that point, you should peruse a line containing a solitary whole number ― the solution to your inquiry or −1 if the inquiry is invalid or you posed to in excess of 20 inquiries. 
 
At last, you should print a line containing two space-isolated numbers 2 and X, where X=A1⊕A2⊕… ⊕AN. At that point, you should peruse a line containing a solitary number: 1 if your answer was right or −1 in the event that it was mistaken. In the event that your answer was right, you should keep settling the rest of the experiments. 
 
Note that when you get an answer −1, you ought to quickly end your program to get a Wrong Answer decision; else, you may get any decision. Remember to flush the yield subsequent to printing each line! 
 
Requirements 
 
1≤T≤100 
 
1≤N≤103 
 
1≤Ai≤106 for each legitimate I 
 
Subtasks 
 
Subtask #1 (15 focuses): Ai≤100 for each legitimate I 
 
Subtask #2 (85 focuses): unique requirements 
 
Model 
 
You Grader 
 
 
 
1 2 
 
10 
 
1 5 
 
18 
 
2 4 
 
 
Clarification 
 
Model case 1: The shrouded grouping is A=[1,2,3,4]. 
 
We pose an inquiry with K=2. The grader reacts with A1⊕2+A2⊕2+A3⊕2+A4⊕2=10. 
 
At that point, we pose an inquiry with K=5 and the grader reacts with A1⊕5+A2⊕5+A3⊕5+A4⊕5=18. 
 
Consequently, A1⊕A2⊕A3⊕A4=4.
 
VIDEO HAS BEEN REMOVED.

6 thoughts on “Find XOR SOLUTIONS FINXOR”

Leave a Comment

close
error: Content is protected !!
Free Udemy Courses and Hacking Resources Join Us on TelegramClick Here
+