Submission #19513219
Source Code Expand
Copy
import java.util.*; import java.io.*; public class Main { static FastScanner sc = new FastScanner(System.in); static PrintWriter pw = new PrintWriter(System.out); static StringBuilder sb = new StringBuilder(); public static void main(String[] args) throws Exception { int n = sc.nextInt(); int[] a = sc.nextIntArray(n); int xor = 0; for(int i = 0; i < n; i++) xor ^= a[i]; if(xor != 0){ pw.println(-1); }else{ sb.append(0).append("\n"); for(int i = 1; i < n-1; i++){ int now = a[i] ^ a[i+1]; sb.append(now).append("\n"); } sb.append(a[n-1]).append("\n"); pw.println(sb.toString()); } pw.flush(); } static class GeekInteger { public static void save_sort(int[] array) { shuffle(array); Arrays.sort(array); } public static int[] shuffle(int[] array) { int n = array.length; Random random = new Random(); for (int i = 0, j; i < n; i++) { j = i + random.nextInt(n - i); int randomElement = array[j]; array[j] = array[i]; array[i] = randomElement; } return array; } public static void save_sort(long[] array) { shuffle(array); Arrays.sort(array); } public static long[] shuffle(long[] array) { int n = array.length; Random random = new Random(); for (int i = 0, j; i < n; i++) { j = i + random.nextInt(n - i); long randomElement = array[j]; array[j] = array[i]; array[i] = randomElement; } return array; } } } class FastScanner { private BufferedReader reader = null; private StringTokenizer tokenizer = null; public FastScanner(InputStream in) { reader = new BufferedReader(new InputStreamReader(in)); tokenizer = null; } public String next() { if (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public String nextLine() { if (tokenizer == null || !tokenizer.hasMoreTokens()) { try { return reader.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken("\n"); } public long nextLong() { return Long.parseLong(next()); } public int nextInt() { return Integer.parseInt(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String[] nextArray(int n) { String[] a = new String[n]; for (int i = 0; i < n; i++) a[i] = next(); return a; } public int[] nextIntArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } public long[] nextLongArray(int n) { long[] a = new long[n]; for (int i = 0; i < n; i++) a[i] = nextLong(); return a; } } class pair implements Comparable<pair> { long x; long y; public pair(long x, long y) { this.x = x; this.y = y; } public String toString() { return x + " " + y; } public boolean equals(Object o) { if (o instanceof pair) { pair p = (pair) o; return p.x == x && p.y == y; } return false; } public int hashCode() { return new Double(x).hashCode() * 31 + new Double(y).hashCode(); } public int compareTo(pair other) { if (this.x == other.x) { return Long.compare(this.y, other.y); } return Long.compare(this.x, other.x); } } class tuble implements Comparable<tuble> { int x; int y; int z; public tuble(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } public String toString() { return x + " " + y + " " + z; } public boolean equals(Object o) { if (o instanceof tuble) { tuble p = (tuble) o; return p.x == x && p.y == y && p.z == z; } return false; } public int hashCode() { return new Double(x).hashCode() * 31 + new Double(y).hashCode() + new Double(z).hashCode() * 31 * 31; } public int compareTo(tuble other) { if (this.x == other.x) { if (this.y == other.y) { return this.z - other.z; } return this.y - other.y; } else { return this.x - other.x; } } }
Submission Info
Submission Time | |
---|---|
Task | B - Your Numbers are XORed... |
User | shojin_pro |
Language | Java (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 5271 Byte |
Status | WA |
Exec Time | 220 ms |
Memory | 45132 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | subtask0_sample-01.txt, subtask0_sample-02.txt, subtask0_sample-03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
subtask0_sample-01.txt | WA | 73 ms | 25208 KB |
subtask0_sample-02.txt | AC | 69 ms | 25296 KB |
subtask0_sample-03.txt | WA | 69 ms | 25188 KB |
subtask1_01.txt | WA | 72 ms | 25128 KB |
subtask1_02.txt | WA | 73 ms | 25456 KB |
subtask1_03.txt | WA | 72 ms | 25428 KB |
subtask1_04.txt | WA | 74 ms | 25324 KB |
subtask1_05.txt | WA | 71 ms | 25204 KB |
subtask1_06.txt | AC | 74 ms | 25456 KB |
subtask1_07.txt | WA | 73 ms | 25556 KB |
subtask1_08.txt | AC | 80 ms | 25868 KB |
subtask1_09.txt | WA | 107 ms | 28076 KB |
subtask1_10.txt | WA | 145 ms | 32544 KB |
subtask1_11.txt | WA | 174 ms | 38860 KB |
subtask1_12.txt | AC | 144 ms | 36560 KB |
subtask1_13.txt | WA | 164 ms | 37856 KB |
subtask1_14.txt | WA | 201 ms | 45132 KB |
subtask1_15.txt | AC | 172 ms | 40616 KB |
subtask1_16.txt | WA | 190 ms | 41916 KB |
subtask1_17.txt | WA | 216 ms | 44840 KB |
subtask1_18.txt | AC | 170 ms | 40216 KB |
subtask1_19.txt | WA | 213 ms | 44356 KB |
subtask1_20.txt | WA | 220 ms | 45080 KB |