#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 15 18:56:45 2017

@author: brendontucker
"""
a = [22, 26, 6, 22, 17, 11, 9, 22, 7, 12]
b = [14, 25, 22, 27, 22, 30, 6, 26, 30, 27]
v = 37


#bruteforce first
#bruteforce passes tests but doesn't compute in enough time
'''
counter = 0
counter2 = 0
boo = False
while counter < len(a):
    counter2 = 0
    while counter2 < len(b):
        if a[counter] + b[counter2] == v:
            boo = True
            break
        else:
            counter2 += 1
    counter += 1
'''

a.sort()
b.sort()
#could I do an altered version of Newton's Method? -- for both a and b?
start = 1 
end1 = len(a) - 1
end2 = len(b) - 1
counter = 0
counter2 = 0
#exit condition for false, start == end
while boo != True:
    if a[counter] + b[counter2] == v:
        boo = True
        break #do I need this?
    elif counter == 0:
        counter += 1
        break
    elif counter2 == 0:
        counter2 += 1
        break
    elif a[counter] + b[counter2] < v:
            counter = end1 // start
            if a[counter] + b[counter2] == v:
                boo = True
                break
            elif a[counter] + b[counter2] <:
                
        


















'''
#work down one list, check if sum is bigger than v,
#work up tthe other list
#can also consider using sum to get the average of each list and using that
#to determine starting place
#also need to check for special case with 0?
counter = 0
counter2 = len(b) - 1
boo = False
#doesn't pass all tests
while counter < len(a):
    counter2 = len(b) - 1
    while counter2 > 0:
        if a[counter] + b[counter2] == v:
            boo = True
            break
        elif b[counter2] > v: #this will take care of special case for zero if zero in a
            counter2 -= 1
        elif a[counter] + b[counter2] > v:
            counter2 -= 1
        elif a[counter] + b[counter2] < v:
            break
    counter += 1
'''











