1def check_if_comfy_until_now(cars, students):
2 for st in students:
3 if st.is_comfy():
4 continue
5 else:
6 return False
7 return True
8
9
10def organize(cars, students):
11
12 if (len(cars) < len(students) // 4):
13 return False
14
15 for car in cars:
16 for student in students:
17 try:
18 car.add_student(student)
19 flag_comfy = check_if_comfy_until_now(cars, students)
20 if flag_comfy == True:
21 return True
22 except EnvironmentError:
23 continue
24
25 if flag_comfy == False:
26 for st in students:
27 try:
28 car.remove_student(st)
29 except EnvironmentError:
30 continue
31
32 return False
33
F..FF
======================================================================
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 90, in test_big_input
anti_rusalov_true(self, organize(cars, students))
AssertionError: False is not true
======================================================================
FAIL: 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))
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 65, in test_single_solution_case
anti_rusalov_true(self, organize(cars, students))
AssertionError: False is not true
----------------------------------------------------------------------
Ran 5 tests in 0.001s
FAILED (failures=3)