Contest Duration: ~ (local time) (140 minutes) Back to Home

Submission #3222844

Source Code Expand

Copy
```# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)

return int(input())

return list(map(int, input().split()))

return float(input())

return list(map(float, input().split()))

return input().strip()

return list(map(str, input().split()))

def error_print(*args):
print(*args, file=sys.stderr)

def mt(f):
import time

def wrap(*args, **kwargs):
s = time.time()
ret = f(*args, **kwargs)
e = time.time()

error_print(e - s, 'sec')
return ret

return wrap

@mt
def slv(N, X, x):

x.reverse()
sa = [0]
for a in x:
sa.append(sa[-1]+a)

ans = sys.maxsize
for k in range(1, N+1):
t = X*N
for j in range(1, math.ceil(N/k)+1):
s = (j-1)*k
e = (j)*k
if e >= len(sa):
e = len(sa)-1

if j == 1:
t += 5*(sa[e]-sa[s])
else:
t += (2*j+1)*(sa[e]-sa[s])

t += k*X
ans = min(ans, t)
return ans

def main():
print(slv(N, X, x))

if __name__ == '__main__':
main()
```

#### Submission Info

Submission Time 2018-09-19 05:33:45+0900 B - Garbage Collector patahene PyPy3 (2.4.0) 700 1702 Byte AC 466 ms 119376 KB

#### Judge Result

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 332 ms 64364 KB
sample_02.txt 258 ms 59628 KB
sample_03.txt 261 ms 59628 KB
sample_04.txt 255 ms 59628 KB
stest_01.txt 286 ms 62060 KB
stest_02.txt 284 ms 61804 KB
stest_03.txt 258 ms 59628 KB
stest_04.txt 259 ms 59628 KB
stest_05.txt 281 ms 61676 KB
stest_06.txt 281 ms 60780 KB
stest_07.txt 273 ms 60908 KB
stest_08.txt 285 ms 61804 KB
stest_09.txt 277 ms 60908 KB
stest_10.txt 284 ms 60908 KB
stest_11.txt 287 ms 61804 KB
stest_12.txt 269 ms 60140 KB
test_13.txt 466 ms 119376 KB
test_14.txt 466 ms 119376 KB
test_15.txt 309 ms 66924 KB
test_16.txt 420 ms 106828 KB
test_17.txt 426 ms 106828 KB
test_18.txt 294 ms 64960 KB
test_19.txt 440 ms 110728 KB
test_20.txt 444 ms 110600 KB
test_21.txt 429 ms 110600 KB
test_22.txt 440 ms 110600 KB
test_23.txt 423 ms 106828 KB
test_24.txt 425 ms 106828 KB
test_25.txt 349 ms 78800 KB
test_26.txt 431 ms 110600 KB
test_27.txt 436 ms 110600 KB
test_28.txt 399 ms 101480 KB