Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.191 s | 14 KBi |
#2 |
Correcto
|
0.104 s | 16 KBi |
#3 |
Correcto
|
0.105 s | 17 KBi |
#4 |
Correcto
|
0.169 s | 15 KBi |
#5 |
Correcto
|
0.174 s | 16 KBi |
#6 |
Correcto
|
0.16 s | 21 KBi |
#7 |
Correcto
|
0.16 s | 29 KBi |
#8 |
Correcto
|
0.163 s | 38 KBi |
#9 |
Correcto
|
0.164 s | 14 KBi |
#10 |
Correcto
|
0.176 s | 13 KBi |
// "static void main" must be defined in a public class. import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); final int arraySize = scanner.nextInt(); int[] input = new int[arraySize]; for(int i = 0; i < arraySize; i++) { input[i] = scanner.nextInt(); } Arrays.sort(input); //Queries final int queryCount = scanner.nextInt(); for(int j = 0; j < queryCount; j++) { int currentQuery = scanner.nextInt(); for(int k = 0; k < arraySize; k++) { int count = 5; int current = input[k]; if(current > currentQuery) { System.out.println(arraySize - k); break; } else if(k == arraySize -1) { System.out.println(0); } } } scanner.close(); } }