Submission details
Task:Cow heist
Sender:aalto25b_009
Submission time:2025-09-10 17:05:17 +0300
Language:Python3 (PyPy3)
Status:READY
Result:
Test results
testverdicttime
#10.07 sdetails
#20.06 sdetails
#30.06 sdetails
#40.06 sdetails
#50.06 sdetails
#60.06 sdetails
#70.06 sdetails
#80.07 sdetails
#90.06 sdetails
#100.06 sdetails
#110.07 sdetails
#120.07 sdetails
#130.07 sdetails
#140.06 sdetails
#150.07 sdetails
#160.06 sdetails
#170.06 sdetails
#180.06 sdetails
#190.06 sdetails
#200.06 sdetails
#210.06 sdetails
#220.07 sdetails
#230.06 sdetails
#240.06 sdetails
#250.06 sdetails
#260.06 sdetails
#270.06 sdetails
#280.06 sdetails
#290.06 sdetails
#300.06 sdetails
#310.06 sdetails
#320.06 sdetails
#330.06 sdetails
#340.06 sdetails
#350.06 sdetails
#360.06 sdetails
#370.06 sdetails
#380.06 sdetails
#390.06 sdetails
#400.06 sdetails
#410.06 sdetails
#420.06 sdetails
#430.06 sdetails
#440.06 sdetails
#450.06 sdetails
#460.06 sdetails
#470.07 sdetails
#480.07 sdetails
#490.06 sdetails
#500.07 sdetails
#510.07 sdetails
#520.07 sdetails
#530.06 sdetails
#540.07 sdetails
#550.07 sdetails
#560.06 sdetails
#570.06 sdetails
#580.08 sdetails
#590.09 sdetails
#600.08 sdetails
#610.08 sdetails
#620.09 sdetails

Code

from itertools import combinations

'''根据题目目前也就是说,有n整数个篮子
每个篮子分别有c1,c2,crc32
你应该能够找到一些x1,x2,...x30. 总共30个
能够让其中任意x_n加起来能够得到c_i
怎么分解成代码'''


n = int(input())
c = list(map(int, input().split()))
for i in range(n):
    c_i = int(input())
    c_list.append(c_i)



c_list=sorted(c_list)

def construct_x_list(c_list,total_length=30):
    x_list = []
    for i, c in enumerate(c_list):
        if i==0:
            x_list.append(c)
        else:
            diff=c-sum(x_list)
            if diff>0 and diff not in x_list:
                x_list.append(diff)
            else:
                candidate = 1
                while candidate in x_list or candidate + sum(x_list) > c:
                    candidate += 1
                x_list.append(candidate)
    while len(x_list)<total_length:
        x_list.append(0)
    return x_list

x_list=construct_x_list(c_list,30)
print(x_list)


def subset_sum_possible(target, x_list):
    for r in range(1,len(x_list)+1):
        for comb in combinations(x_list,r):
            if sum(comb)==target:
                return True
        return False

def dfs(c_list, x_list,index):
    if index==len(x_list):
        for c_i in c_list:
                if not subset_sum_possible(c_i, x_list):
                    return False
                return True


    for val in possible_values:
        x_list[index]=val
        if dfs(c_list, x_list,index+1):
            return True
    return False


found = dfs(c_list, x_list, 0)

if found:
    print(x_list)

Test details

Test 1

Verdict:

input
1
11

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 2

Verdict:

input
2
9 20

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 3

Verdict:

input
3
18 2 8

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 4

Verdict:

input
3
4 9 15

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 5

Verdict:

input
3
4 16 15

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 6

Verdict:

input
4
8 10 6 14

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 7

Verdict:

input
4
14 15 6 9

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 8

Verdict:

input
5
11 12 15 17 13

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 9

Verdict:

input
5
9 20 15 19 1

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 10

Verdict:

input
5
9 4 1 19 11

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 11

Verdict:

input
5
12 2 15 17 6

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 12

Verdict:

input
5
20 19 11 4 20

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 13

Verdict:

input
5
5 2 18 17 5

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 14

Verdict:

input
5
18 19 7 5 17

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 15

Verdict:

input
5
2 5 16 7 9

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 16

Verdict:

input
5
18 1 20 5 18

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 17

Verdict:

input
5
1 8 11 10 10

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 18

Verdict:

input
10
11 12 15 17 13 18 11 17 9 13

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 19

Verdict:

input
10
9 20 15 19 1 3 7 20 3 5

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 20

Verdict:

input
10
9 4 1 19 11 19 9 10 9 7

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 21

Verdict:

input
10
12 2 15 17 6 3 11 12 18 9

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 22

Verdict:

input
10
20 19 11 4 20 18 15 13 14 12

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 23

Verdict:

input
10
5 2 18 17 5 8 19 20 10 2

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 24

Verdict:

input
10
18 19 7 5 17 2 1 8 3 20

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 25

Verdict:

input
10
2 5 16 7 9 20 15 10 20 7

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 26

Verdict:

input
10
18 1 20 5 18 8 11 17 5 9

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 27

Verdict:

input
10
1 8 11 10 10 1 3 7 3 1

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 28

Verdict:

input
100
548938 592979 715351 844456 60...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 29

Verdict:

input
100
417116 997410 720487 932768 11...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 30

Verdict:

input
100
436094 185124 25933 931751 549...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 31

Verdict:

input
100
550922 70741 708308 840139 290...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 32

Verdict:

input
100
967248 900825 547356 172735 97...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 33

Verdict:

input
100
222044 55193 870929 831516 206...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 34

Verdict:

input
100
893062 947690 332055 209454 82...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 35

Verdict:

input
100
76326 227391 780095 319045 438...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 36

Verdict:

input
100
873627 11117 968759 239494 869...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 37

Verdict:

input
100
10377 364544 501988 499243 495...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 38

Verdict:

input
200
548938 592979 715351 844456 60...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 39

Verdict:

input
200
417116 997410 720487 932768 11...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 40

Verdict:

input
200
436094 185124 25933 931751 549...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 41

Verdict:

input
200
550922 70741 708308 840139 290...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 42

Verdict:

input
200
967248 900825 547356 172735 97...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 43

Verdict:

input
200
222044 55193 870929 831516 206...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 44

Verdict:

input
200
893062 947690 332055 209454 82...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 45

Verdict:

input
200
76326 227391 780095 319045 438...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 46

Verdict:

input
200
873627 11117 968759 239494 869...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 47

Verdict:

input
200
10377 364544 501988 499243 495...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 48

Verdict:

input
1000
548938 592979 715351 844456 60...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 49

Verdict:

input
1000
417116 997410 720487 932768 11...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 50

Verdict:

input
1000
436094 185124 25933 931751 549...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 51

Verdict:

input
1000
550922 70741 708308 840139 290...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 52

Verdict:

input
1000
967248 900825 547356 172735 97...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 53

Verdict:

input
1000
222044 55193 870929 831516 206...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 54

Verdict:

input
1000
893062 947690 332055 209454 82...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 55

Verdict:

input
1000
76326 227391 780095 319045 438...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 56

Verdict:

input
1000
873627 11117 968759 239494 869...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 57

Verdict:

input
1000
10377 364544 501988 499243 495...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 58

Verdict:

input
100000
548938 592979 715351 844456 60...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 59

Verdict:

input
100000
417116 997410 720487 932768 11...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 60

Verdict:

input
100000
436094 185124 25933 931751 549...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 61

Verdict:

input
100000
550922 70741 708308 840139 290...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...

Test 62

Verdict:

input
100000
967248 900825 547356 172735 97...

correct output
1 2 4 8 16 32 64 128 256 512 1...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 13, in <module>
    c_i =...