大佬们可否帮我看一下京东笔试第二题这样写为什么WA
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class JD2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; int[] b = new int[n]; int[] c = new int[n]; int[] sorteda = new int[n]; int[] sortedb = new int[n]; int[] sortedc = new int[n]; List<Integer> troubleList = new ArrayList<>(); for (int i = 0; i < n; i++) { a[i] = in.nextInt(); sorteda[i] = a[i]; b[i] = in.nextInt(); sortedb[i] = b[i]; c[i] = in.nextInt(); sortedc[i] = c[i]; } Arrays.sort(sorteda); Arrays.sort(sortedb); Arrays.sort(sortedc); for (int i = 0; i < n; i++) { int pos = Arrays.binarySearch(sorteda,a[i]); if (pos >= n-1) break; else troubleList.add(i); } if (troubleList.isEmpty()) System.out.println(0); for (int tmp = 0;tmp < troubleList.size(); tmp++) { int pos = Arrays.binarySearch(sortedb,b[tmp]); if (pos >= n-1) troubleList.remove(tmp); } if (troubleList.isEmpty()) System.out.println(0); for (int tmp = 0;tmp < troubleList.size(); tmp++) { int pos = Arrays.binarySearch(sortedc,c[tmp]); if (pos >= n-1) troubleList.remove(tmp); } System.out.println(troubleList.size()); } }