Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.022 s | 3 KBi |
#2 |
Correcto
|
0.025 s | 3 KBi |
#3 |
Correcto
|
0.026 s | 3 KBi |
#4 |
Correcto
|
0.027 s | 3 KBi |
#5 |
Correcto
|
0.021 s | 3 KBi |
#6 |
Correcto
|
0.024 s | 3 KBi |
#7 |
Correcto
|
0.021 s | 3 KBi |
#8 |
Correcto
|
0.024 s | 3 KBi |
#9 |
Correcto
|
0.022 s | 3 KBi |
#10 |
Correcto
|
0.027 s | 3 KBi |
#11 |
Correcto
|
0.025 s | 3 KBi |
#12 |
Correcto
|
0.514 s | 8 KBi |
#13 |
Correcto
|
0.591 s | 5 KBi |
#14 |
Correcto
|
0.705 s | 14 KBi |
#15 |
Correcto
|
0.451 s | 14 KBi |
#16 |
Correcto
|
0.581 s | 14 KBi |
#17 |
Correcto
|
0.609 s | 14 KBi |
def find_index(arr, length, x): lo, hi = 0, length while lo < hi: mid = (lo + hi) // 2 if arr[mid] <= x: lo = mid + 1 else: hi = mid return lo n = int(input()) array = [int(num) for num in input().split()] for _ in range(int(input())): x = int(input()) print(find_index(array, n, x))