Submission #3222854


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 = []
for k in range(1, N + 1):
    e = 5
    cur = N - k
    tmp = e * (B[N] - B[cur]) + (N + k) * X
    cur -= k
    while True:
        tmp += e * (B[cur + k] - B[max(cur, 0)])
        if cur <= 0:
            break
        e += 2
        cur -= k

    ans.append(tmp)

print(min(ans))

Submission Info

Submission Time
Task B - Garbage Collector
User uni745e
Language Python3 (3.4.3)
Score 700
Code Size 482 Byte
Status
Exec Time 1994 ms
Memory 30572 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 16 ms 3064 KB
sample_02.txt 17 ms 3064 KB
sample_03.txt 17 ms 3064 KB
sample_04.txt 17 ms 3064 KB
stest_01.txt 30 ms 3188 KB
stest_02.txt 29 ms 3188 KB
stest_03.txt 17 ms 3064 KB
stest_04.txt 17 ms 3064 KB
stest_05.txt 25 ms 3188 KB
stest_06.txt 23 ms 3064 KB
stest_07.txt 28 ms 3188 KB
stest_08.txt 29 ms 3188 KB
stest_09.txt 21 ms 3064 KB
stest_10.txt 30 ms 3188 KB
stest_11.txt 28 ms 3188 KB
stest_12.txt 18 ms 3064 KB
test_13.txt 1882 ms 30508 KB
test_14.txt 1943 ms 29956 KB
test_15.txt 361 ms 8264 KB
test_16.txt 1985 ms 30572 KB
test_17.txt 1904 ms 30572 KB
test_18.txt 239 ms 7176 KB
test_19.txt 1826 ms 29704 KB
test_20.txt 1967 ms 30168 KB
test_21.txt 1774 ms 29608 KB
test_22.txt 1976 ms 29632 KB
test_23.txt 1850 ms 29524 KB
test_24.txt 1800 ms 29688 KB
test_25.txt 946 ms 16816 KB
test_26.txt 1994 ms 29696 KB
test_27.txt 1786 ms 29728 KB
test_28.txt 1490 ms 25148 KB