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

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

0 точки общо

0 успешни теста
5 неуспешни теста
Код

 1class organize:
 2    def __call__(self, cars, students):
 3        if not cars or not students:
 4            return False
 5
 6        def is_valid_config():
 7            for student in students:
 8                if not student.is_comfy():
 9                    return False
10            return True
11
12        def place_students(place):
13            if place >= len(students):
14                return is_valid_config()
15
16            student = students[place]
17            for car in cars:
18                try:
19                    car.add_student(student)
20                    if place_students(place + 1):
21                        return True
22                    car.remove_student(student)
23                except EnvironmentError:
24                    pass
25
26            return False
27
28        return place_students(0)

EEEEE
======================================================================
ERROR: test_big_input (test.TesFull)
Test a big case to ensure no huge bruteforcing.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 90, in test_big_input
anti_rusalov_true(self, organize(cars, students))
TypeError: organize() takes no arguments

======================================================================
ERROR: test_empty (test.TesFull)
Test with empty cars.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 27, in test_empty
anti_rusalov_false(self, organize([], students))
TypeError: organize() takes no arguments

======================================================================
ERROR: 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))
TypeError: organize() takes no arguments

======================================================================
ERROR: test_regular_case (test.TesFull)
Test a regular case.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 47, in test_regular_case
anti_rusalov_true(self, organize(cars, students))
TypeError: organize() takes no arguments

======================================================================
ERROR: test_single_solution_case (test.TesFull)
Test a single-solution case.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 65, in test_single_solution_case
anti_rusalov_true(self, organize(cars, students))
TypeError: organize() takes no arguments

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

FAILED (errors=5)

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