Предизвикателства > Осмодекемврийско пътуване > Решения > Решението на Мария Кукова

Резултати
0 точки от тестове
0 точки от учител

0 точки общо

1 успешни теста
4 неуспешни теста
Код

 1def backtrack(cars, students, i):
 2    if i == len(students) - 1:
 3        return True
 4    for car in cars:
 5        try:
 6            car.add_student(students[i])
 7            if students[i].is_comfy() and backtrack(cars, students, i+1):
 8                return True
 9            car.remove_student(students[i])
10        except EnvironmentError:
11            pass
12    return False
13
14
15def organize(cars, students):
16    if len(students) > len(cars) * 4:
17        return False
18    return backtrack(cars, students, 0)

F.FFF
======================================================================
FAIL: test_big_input (test.TesFull)
Test a big case to ensure no huge bruteforcing.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 91, in test_big_input
anti_rusalov_true(self, all([x.is_comfy() is True for x in students]))
AssertionError: False is not true

======================================================================
FAIL: test_real_case_false (test.TesFull)
Test a real case for False.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 36, in test_real_case_false
anti_rusalov_false(self, organize(cars, students))
AssertionError: True is not false

======================================================================
FAIL: test_regular_case (test.TesFull)
Test a regular case.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 48, in test_regular_case
anti_rusalov_true(self, all([x.is_comfy() is True for x in students]))
AssertionError: False is not true

======================================================================
FAIL: test_single_solution_case (test.TesFull)
Test a single-solution case.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 66, in test_single_solution_case
anti_rusalov_true(self, all([x.is_comfy() is True for x in students]))
AssertionError: False is not true

----------------------------------------------------------------------
Ran 5 tests in 0.001s

FAILED (failures=4)

Дискусия
История
Това решение има само една версия.