Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.171 s | 16 KBi |
#2 |
Incorrecto
|
0.194 s | 22 KBi |
#3 |
Correcto
|
0.173 s | 16 KBi |
#4 |
Correcto
|
0.168 s | 16 KBi |
#5 |
Incorrecto
|
0.157 s | 15 KBi |
#6 |
Correcto
|
0.197 s | 22 KBi |
#7 |
Incorrecto
|
0.214 s | 25 KBi |
#8 |
Incorrecto
|
0.191 s | 16 KBi |
#9 |
Correcto
|
0.216 s | 16 KBi |
#10 |
Correcto
|
0.223 s | 20 KBi |
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Data data = readNumsFromStdin(); Arrays.sort(data.numbers); for (int i = 0; i < data.totalRequest; i++) { for (int j = 0; j < data.totalNumbers; j++) { if (data.numbers[j] > data.request[i]) { System.out.println(data.totalNumbers - j); break; } } } } private static Data readNumsFromStdin() { Data data = new Data(); Scanner in = new Scanner(System.in); data.totalNumbers = in.nextInt(); data.numbers = new int[data.totalNumbers]; readArrayFromStdin(data.numbers, data.totalNumbers, in); data.totalRequest = in.nextInt(); data.request = new int[data.totalRequest]; readArrayFromStdin(data.request, data.totalRequest, in); return data; } private static void readArrayFromStdin(int[] array, int count, Scanner in) { for (int i = 0; i < count; i++) { array[i] = in.nextInt(); } } private static class Data { int totalNumbers; int[] numbers; int totalRequest; int[] request; } }