Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jugadores = input().split()
- jugadores = [int(i) for i in jugadores]
- def busqueda_Binaria(a,inicio,fin,x):
- if (inicio==fin):
- if (x>=a[inicio]):
- return inicio
- else:
- return (inicio-1)
- else:
- mitad=(inicio+fin)//2
- if x==a[mitad]:
- return mitad
- else:
- if x>a[mitad]:
- return busqueda_Binaria(a, mitad+1, fin, x)
- else:
- return busqueda_Binaria(a, inicio, mitad-1, x)
- indice=0
- for i in range(0,m):
- if jugadores[i]>=enemigos[n-1]:
- print(enemigos[n-2], "X")
- else:
- if jugadores[i]<=enemigos[0]:
- print("X",enemigos[0])
- else:
- indice=busqueda_Binaria(enemigos,0,n-1,jugadores[i])
- print(enemigos[indice], enemigos[indice+1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement