|
|
back to boardTime limit exceeded, why with this source?? Posted by PetSedm 19 Nov 2012 21:29 import java.util.*; public class HistoryExam { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); List<Integer> professorsList = new ArrayList<Integer>(); for (int i = 0; i < a; i++) { professorsList.add(sc.nextInt()); } int b = sc.nextInt();
int counter = 0;
for (int i = 0; i < b; i++) { int c = sc.nextInt(); if (Collections.binarySearch(professorsList, c)>=0) { counter++;
} } sc.close(); System.out.println(counter); } } |
|
|