generated from OPCODE-Open-Spring-Fest/template
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac8845f
commit bd9a95d
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Your are given two array a and b, each of length n, consisting of non-negative integers. | ||
The i-th elements of a and b are ai and bi, respectively. | ||
A non-negative integer x is said to be good when the following condition is satisfied: | ||
If it is possible to permute b so that ai XOR bi = x holds for every integer i such that 1 ≤ i ≤ n, | ||
where XOR is the bitwise XOR. | ||
Print all good integers in ascending order. | ||
|
||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
|
||
Input: | ||
First line of input contains one integer n(1 <= n <= 2000) - size of the array. | ||
Second line of input contains n integers - array a. | ||
Third line of input contains n integers - array b. | ||
|
||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
|
||
Output: | ||
Print all the good integers in ascending order. | ||
|
||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
|
||
Time Limit: 2 sec | ||
Memory Limit: 1024 MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Sample Input 1: | ||
3 | ||
1 2 3 | ||
6 4 7 | ||
|
||
Sample Output 1: | ||
1 | ||
5 | ||
|
||
If we permute b into (4,7,6), we have a1 XOR b1 = a2 XOR b2 = a3 XOR b3 = 5, so 5 is a good integer. | ||
There are no other good integers. | ||
|
||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
|
||
Sample Input 2: | ||
2 | ||
0 1 | ||
0 2 | ||
|
||
Sample Output 2: | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Write your code here. |