Exemple #1
0
def test_solution():
    from utils import check_time_limit
    warped_solution = check_time_limit(solution, 0.01)

    slot = [False] * 30
    slot = warped_solution(1, 3, slot)
    assert slot == [
        True, False, False, True, False, False, True, False, False, True,
        False, False, True, False, False, True, False, False, True, False,
        False, True, False, False, True, False, False, True, False, False
    ]

    slot = warped_solution(3, 7, slot)
    assert slot == [
        True, False, True, True, False, False, True, False, False, True, False,
        False, True, False, False, True, True, False, True, False, False, True,
        False, True, True, False, False, True, False, False
    ]

    slot = warped_solution(1, 4, slot)
    assert slot == [
        True, False, True, True, True, False, True, False, True, True, False,
        False, True, False, False, True, True, False, True, False, True, True,
        False, True, True, False, False, True, True, False
    ]
Exemple #2
0
def test_solution():
    from utils import check_time_limit
    warped_solution = check_time_limit(solution, 0.0078125)
    assert warped_solution([[-6, -8, 7, -4], [-5, -5, 14, 11],
                            [11, 11, -1, -1], [4, 9, -2, -4]]) == 11
    assert warped_solution([[-1, 2, 14, 7, -4, 5, 8, 9],
                            [10, 6, 23, 2, 1, 1, 7, 11],
                            [9, 3, 5, -2, 4, 4, 6, 6],
                            [7, 15, 0, 8, 21, 9, 6, 6],
                            [19, 8, 12, -8, 4, 5, 2, 9],
                            [1, 2, 3, 4, 5, 6, 7, 8],
                            [9, 10, 11, 12, 13, 14, 15, 16],
                            [17, 18, 19, 20, 21, 22, 23, 24]]) == 17
Exemple #3
0
def test_solution():
    from utils import check_time_limit
    warped_solution = check_time_limit(solution, 0.5)
    assert warped_solution([[20, 10, 30], [10, 20, 60], [80, 25, 79],
                            [30, 50, 80], [80, 25, 81]]) == 2
Exemple #4
0
def test_solution():
    from utils import check_time_limit
    warped_solution = check_time_limit(solution, 2 / (2**50))
    assert solution('A', 'BABA') == True
    assert solution('BAAAAABAA', 'BAAAAABAA') == True
    assert solution('A', 'ABBA') == False
Exemple #5
0
def test_solution():
    from utils import check_time_limit
    warped_solution = check_time_limit(solution, 0.01)
    assert warped_solution(2, [1, 2], 1000) == 501
    assert warped_solution(3, [1, 5, 10], 100) == 121
    assert warped_solution(2, [5, 7], 22) == 1
Exemple #6
0
def test_solution():
    from utils import check_time_limit
    warped_solution = check_time_limit(solution, 1)
    assert warped_solution([3, 2, 3, 2]) == 8
    assert warped_solution([6, 4, 5, 5, 5, 5]) == 21
Exemple #7
0
def test_solution():
    from utils import check_time_limit
    warped_solution = check_time_limit(solution, 1)
    assert warped_solution('micro soft') == 'MS'
    assert warped_solution('biti ali i ne biti') == 'BNB'
    assert warped_solution('ali ja sam i jucer jeo') == 'AJSJJ'
Exemple #8
0
def test_solution():
    from utils import check_time_limit
    warped_solution = check_time_limit(solution, 2)
    assert warped_solution(3, [[1, 2], [3, 6], [5, 8]], 1) == 0
    assert warped_solution(3, [[1, 2], [3, 4], [5, 8]], 1) == 1
    assert warped_solution(3, [[1, 2], [3, 6], [5, 8]], 2) == 1