Submission #3222926


Source Code Expand

Copy
# coding:utf-8


INF = float('inf')


def inpl(): return list(map(int, input().split()))


N, X = inpl()
A = inpl()
B = [0]
for a in A:
    B.append(B[-1] + a)

ans = INF
for k in range(1, N + 1):
    tmp = 5 * B[N] + (N + k) * X
    cur = N - 2 * k
    while cur > 0:
        tmp += 2 * B[cur]
        cur -= k
    ans = min(ans, tmp)
print(ans)

Submission Info

Submission Time
Task B - Garbage Collector
User uni745e
Language Python3 (3.4.3)
Score 700
Code Size 371 Byte
Status
Exec Time 1061 ms
Memory 25708 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Subtask1 400 / 400 sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, stest_01.txt, stest_02.txt, stest_03.txt, stest_04.txt, stest_05.txt, stest_06.txt, stest_07.txt, stest_08.txt, stest_09.txt, stest_10.txt, stest_11.txt, stest_12.txt
All 300 / 300 sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, stest_01.txt, stest_02.txt, stest_03.txt, stest_04.txt, stest_05.txt, stest_06.txt, stest_07.txt, stest_08.txt, stest_09.txt, stest_10.txt, stest_11.txt, stest_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt
Case Name Status Exec Time Memory
sample_01.txt 17 ms 3064 KB
sample_02.txt 17 ms 3060 KB
sample_03.txt 17 ms 3060 KB
sample_04.txt 17 ms 3064 KB
stest_01.txt 24 ms 3188 KB
stest_02.txt 23 ms 3188 KB
stest_03.txt 17 ms 3060 KB
stest_04.txt 17 ms 3060 KB
stest_05.txt 21 ms 3188 KB
stest_06.txt 21 ms 3060 KB
stest_07.txt 24 ms 3188 KB
stest_08.txt 22 ms 3188 KB
stest_09.txt 19 ms 3064 KB
stest_10.txt 23 ms 3188 KB
stest_11.txt 22 ms 3188 KB
stest_12.txt 17 ms 3060 KB
test_13.txt 898 ms 25708 KB
test_14.txt 910 ms 25200 KB
test_15.txt 169 ms 7388 KB
test_16.txt 872 ms 24456 KB
test_17.txt 1012 ms 24744 KB
test_18.txt 133 ms 6220 KB
test_19.txt 894 ms 24136 KB
test_20.txt 871 ms 24968 KB
test_21.txt 1061 ms 24136 KB
test_22.txt 903 ms 24136 KB
test_23.txt 914 ms 23588 KB
test_24.txt 872 ms 24744 KB
test_25.txt 427 ms 13924 KB
test_26.txt 1019 ms 24252 KB
test_27.txt 941 ms 24136 KB
test_28.txt 688 ms 20964 KB