|
|
вернуться в форумTime limit exceeded, why with this source?? 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); } } |
|
|