Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.021 s | 3 KBi |
#2 |
Incorrecto
|
0.019 s | 3 KBi |
#3 |
Correcto
|
0.019 s | 3 KBi |
#4 |
Correcto
|
0.024 s | 3 KBi |
#5 |
Incorrecto
|
0.022 s | 3 KBi |
#6 |
Incorrecto
|
0.021 s | 3 KBi |
#7 |
Incorrecto
|
0.023 s | 3 KBi |
#8 |
Incorrecto
|
0.02 s | 3 KBi |
#9 |
Incorrecto
|
0.02 s | 3 KBi |
#10 |
Incorrecto
|
0.019 s | 3 KBi |
n = int(input()) arr = sorted(list(map(int, input().split(" ")))) def binary_search(arr, low, high, x): if high > low: mid = (high + low) // 2 if arr[mid] == x: return mid elif arr[mid] > x: return binary_search(arr, low, mid - 1, x) else: return binary_search(arr, mid + 1, high, x) else: return -1 c = int(input()) for i in range(0, c): x = int(input()) index = binary_search(arr, 0, n, x) if index == -1: print(n) else: for j in range(index, n): if arr[j] > x: break index = j print(n - index - 1)