|
|
вернуться в форумCheck your tests! This is my solution: Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n1 = in.nextInt(); int[] a = new int[n1]; for (int i = 0; i < n1; i++) a[i] = in.nextInt(); // Arrays.sort(a); int n2 = in.nextInt(); int[] b = new int[n2]; for (int i = 0; i < n2; i++) b[i] = in.nextInt(); // Arrays.sort(b); boolean res = false; for (int i = 0; i < n1; i++) if (Arrays.binarySearch(b, 10000 - a[i]) >= 0) res = true; if (res) out.println("YES"); else out.println("NO"); out.flush(); It have got WA on test#3 After uncommenting sorting I have got AC. But by the data I must not sort arrays, because its sorted. Am I wrong? Edited by author 11.09.2007 20:08 |
|
|