Pairwise Xors Codechef Solution | APRIL CHALLENGE

Codechef
Share:

Pairwise Xors Codechef Solution

JJ gives Chef a number XX and challenges Chef to come up with three distinct numbers A,A, B,B, and CC such that:

  • 0≤A,B,C<2300≤A,B,C<230;
  • (A⊕B)+(B⊕C)+(C⊕A)=X(A⊕B)+(B⊕C)+(C⊕A)=X.

Help Chef come up with three such numbers or determine that no such tuple exists.

Here, ⊕⊕ denotes the bitwise XOR operation.

Input Format

  • The first line contains a single integer TT – the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains an integer XX – the number mentioned in the problem statement.

Output Format

For each test case, output three distinct numbers AA, BB and CC (0≤A,B,C<230)(0≤A,B,C<230) such that (A⊕B)+(B⊕C)+(C⊕A)=X(A⊕B)+(B⊕C)+(C⊕A)=X.

If multiple such tuples exist, print any. If no such tuple exists, print −1−1.

Constraints

  • 1≤T≤10001≤T≤1000
  • 1≤X<2301≤X<230

Sample Input 1 

3
6
3
20

Sample Output 1 

0 1 3
-1
3 11 1

Explanation

Test Case 11: A=0,B=1,C=3A=0,B=1,C=3 is a valid answer because (0⊕1)+(1⊕3)+(3⊕0)=1+2+3=6(0⊕1)+(1⊕3)+(3⊕0)=1+2+3=6.

Test Case 22: It can be proven that no tuple exists that satisfies the given conditions.

Test Case 33: A=3,B=11,C=1A=3,B=11,C=1 is a valid answer because (3⊕11)+(11⊕1)+(1⊕3)=8+10+2=20(3⊕11)+(11⊕1)+(1⊕3)=8+10+2=20.

Pairwise Xors Codechef  SOLUTION

Download Code
login to google play console, youtube video search by image, how to add a google account, which are the google apps, what is the google app, how to add a new google account, all the google apps, which service is the part of google, adsetting google, google data studio, google DNS, GCP console, bigquery, google studio, google api console, google app engine, anthos, google apis, google public DNS, google audio, google launcher, gcloud console, google compute engine, google webmaster console, google logged-in devices, gdrive unlimited,google console tools,google studio login,my google voice,hey google service,find similar images google, my google forms, www google com bd search, search using images in google,google image search scan,google sea console,website console google, google sound, gdrive storage for students, google site console, google console login, webmaster console, searc h console, google server down, google backup login, photo finder google, google products and services, google console tool, google image check, google cloud search is used for, google dashboard studio, google voice and audio activity,gcp dashboards, google services down, google go app, google dns down, google image identifier,check picture on google,google new launcher,google image finder online,image check google google google go, image finder on google, finding images on google, photo find google, find a picture in google, find the photo on google, picture find google, image find on google, find with photo google, image finder google online, google find with image, photo finder in google, google find image search, search using image in google, search on google with image, google server down today, google server down news

Read More Post Here

Leave a Comment

Your email address will not be published. Required fields are marked *

x