Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.023 s | 3 KBi |
#2 |
Incorrecto
|
0.029 s | 3 KBi |
#3 |
Correcto
|
0.027 s | 3 KBi |
#4 |
Correcto
|
0.024 s | 3 KBi |
#5 |
Correcto
|
0.034 s | 3 KBi |
#6 |
Incorrecto
|
0.016 s | 3 KBi |
#7 |
Correcto
|
0.025 s | 3 KBi |
#8 |
Correcto
|
0.029 s | 3 KBi |
#9 |
Incorrecto
|
0.022 s | 3 KBi |
#10 |
Incorrecto
|
0.025 s | 3 KBi |
import bisect def count_elements_greather_than_x(array, queries): array.sort() for x in queries: x_index = bisect.bisect_right(array, x) if x_index >= len(array): print(0) elif array[x_index - 1] == x: print(len(array) - x_index) else: print(len(array)) array_size = int(input()) array = [int(x) for x in input().split()] number_of_queries = int(input()) queries = [0 for _ in range(number_of_queries)] for i in range(number_of_queries): queries[i] = int(input()) count_elements_greather_than_x(array, queries)