John and the Magic Box
시간 제한12초메모리 제한256 MB
교환법칙과 결합법칙을 만족하는 미지의 연산이 주어질 때, 지정된 k개를 제외한 나머지 원소들의 조합을 q번의 질의마다 구하는 문제입니다.
문제
This is an interactive problem.
John has an array of mysterious integers. He has an access to a magic box that can combine two integers into one. Let be the result of combining two integers, and , with this magic box. After a lot of experiments, John has noticed that the magic box has the following properties:
John has cousins, and each of them likes all the integers in his array except some of them. John wants to give gifts to all his cousins, so he wants to give each cousin the combination of all his integers except the this cousin doesn't like.
John likes his cousins, but his magic box is old and worn off because of his intense experiments. He is willing to use the box at most times. Help him get all the required combinations!
힌트
In each test, the rules for the magic box are fixed and don't depend on your queries. Different rules are used for different tests. It is guaranteed that the magic box satisfies the conditions from the problem statement.
In the sample test, the operation performed by the magic box is assumed to be bitwise OR.