def get_pitch_at_time(genotype, time):
    """given genotype and durk time point, returns pitch being played at that durk point and whether or not pitch ends perfectly on time
    
    Args:
        genotype ((int, int)[]): genotype of chromosome, which is list of (pitch, dur)
        time (int): time point in durks
    
    Returns:
        (int, bool): (pitch, end_on_time) where pitch is [1,21] and end_on_time represents whether or not the pitch ends perfectly at the time point time.
    """
    pitch = -9999
    dur_running_total = 0
    end_on_time = False
    for i, (ed, dur) in enumerate(genotype):
        dur_running_total += dur
        if dur_running_total > time:
            pitch = ed
            break
        elif dur_running_total == time:
            pitch = ed
            end_on_time = True
            break

    return (pitch, end_on_time)