Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.022 s | 3 KBi |
#2 |
Correcto
|
0.022 s | 3 KBi |
#3 |
Correcto
|
0.044 s | 3 KBi |
#4 |
Correcto
|
0.028 s | 3 KBi |
#5 |
Correcto
|
0.027 s | 3 KBi |
#6 |
Correcto
|
0.028 s | 3 KBi |
#7 |
Correcto
|
0.026 s | 3 KBi |
#8 |
Correcto
|
0.032 s | 3 KBi |
#9 |
Correcto
|
0.028 s | 3 KBi |
#10 |
Correcto
|
0.045 s | 3 KBi |
#11 |
Correcto
|
0.024 s | 3 KBi |
#12 |
Tiempo límite excedido
|
1.593 s | 8 KBi |
#13 |
Correcto
|
0.726 s | 5 KBi |
#14 |
Tiempo límite excedido
|
1.593 s | 14 KBi |
#15 |
Correcto
|
0.69 s | 14 KBi |
#16 |
Correcto
|
0.729 s | 14 KBi |
#17 |
Correcto
|
0.642 s | 14 KBi |
def findIndex(arr, num, l, m, r): if l >= r: return m + 1 if arr[m] <= num: l = m+1 return findIndex(arr, num, l, (l + r) // 2, r) else: r = m return findIndex(arr, num, l, (l + r) // 2, r) N = int(input()) arr = list(map(lambda x: int(x), input().split(' '))) c = int(input()) for i in range(c): consulta = int(input()) # print('>> ', end='') print(findIndex(arr, consulta, 0, (len(arr)-1)//2, len(arr))-1)