結果

問題 No.919 You Are A Project Manager
ユーザー convexineqconvexineq
提出日時 2019-10-25 22:58:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,489 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 87,324 KB
実行使用メモリ 80,204 KB
最終ジャッジ日時 2023-10-11 07:44:10
合計ジャッジ時間 36,377 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 74 ms
71,544 KB
testcase_02 AC 71 ms
71,704 KB
testcase_03 AC 70 ms
71,676 KB
testcase_04 AC 106 ms
78,200 KB
testcase_05 AC 108 ms
77,680 KB
testcase_06 AC 76 ms
71,704 KB
testcase_07 AC 533 ms
77,932 KB
testcase_08 AC 130 ms
77,700 KB
testcase_09 AC 106 ms
76,520 KB
testcase_10 AC 148 ms
77,628 KB
testcase_11 AC 142 ms
77,516 KB
testcase_12 AC 73 ms
71,576 KB
testcase_13 AC 174 ms
77,576 KB
testcase_14 AC 80 ms
71,704 KB
testcase_15 AC 97 ms
76,520 KB
testcase_16 AC 249 ms
77,784 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2,018 ms
79,456 KB
testcase_21 AC 970 ms
79,344 KB
testcase_22 AC 590 ms
78,160 KB
testcase_23 AC 568 ms
77,948 KB
testcase_24 AC 623 ms
78,848 KB
testcase_25 AC 598 ms
77,912 KB
testcase_26 WA -
testcase_27 AC 1,574 ms
78,692 KB
testcase_28 AC 2,289 ms
79,496 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 201 ms
79,392 KB
testcase_33 AC 683 ms
78,384 KB
testcase_34 AC 676 ms
78,560 KB
testcase_35 AC 2,379 ms
79,596 KB
testcase_36 AC 2,379 ms
79,684 KB
testcase_37 AC 2,382 ms
80,204 KB
testcase_38 AC 2,386 ms
79,540 KB
testcase_39 AC 71 ms
71,668 KB
testcase_40 AC 93 ms
76,872 KB
testcase_41 AC 71 ms
71,796 KB
testcase_42 AC 72 ms
71,372 KB
testcase_43 AC 83 ms
76,672 KB
testcase_44 AC 99 ms
76,600 KB
testcase_45 AC 74 ms
71,312 KB
testcase_46 AC 101 ms
76,532 KB
testcase_47 AC 599 ms
78,000 KB
testcase_48 AC 588 ms
77,940 KB
testcase_49 WA -
testcase_50 AC 587 ms
78,320 KB
testcase_51 AC 523 ms
78,156 KB
testcase_52 WA -
testcase_53 AC 523 ms
77,844 KB
testcase_54 AC 93 ms
76,504 KB
testcase_55 AC 70 ms
71,632 KB
testcase_56 AC 69 ms
71,588 KB
testcase_57 AC 69 ms
71,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
def Eratosthenes(N): #N以下の素数のリストを返す
    #iが素数のときis_prime_list[i]=1,それ以外は0
    N+=1
    is_prime_list = [True]*N
#    is_prime_list[0], is_prime_list[1] = False, False #リストが必要なときはこの2行を有効化
#    for j in range(4,N,2): is_prime_list[j] = False
    m = int(N**0.5)+1
    for i in range(3,m,2):
        if is_prime_list[i]:
            is_prime_list[i*i::2*i]=[False]*((N-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,N,2) if is_prime_list[i]]
#    return is_prime_list

import sys
#sys.setrecursionlimit(10**6)
readline = sys.stdin.readline 

n = int(input())
a = [int(i) for i in readline().split()]
ra = list(reversed(a))

from itertools import accumulate
primes = [1]+Eratosthenes(n)


def ans(k,a,ra):
    res1 = []
    R1 = [0]
    for i in range(k,n+1,k):
        l = a[i-k:i]
        l.sort()
        res1.append(l[(k+1)//2-1])
    for i in accumulate(res1):
        R1.append(max(R1[-1],i))

#    print(res1,R1)

    res2 = []
    R2 = [0]
    for i in range(k,n+1,k):
        l = ra[i-k:i]
        l.sort()
        res2.append(l[(k+1)//2-1])
    for i in accumulate(res2):
        R2.append(max(R2[-1],i))
#    print(res2,R2)
    
    res1 = R1
    res2 = R2
        
    res = 0    
    for r1,r2 in zip(res1,reversed(res2)):
        res = max(res,r1+r2)
#    print(res*k)
    return(res*k)

c = 0
for p in primes:
    c = max(c,ans(p,a,ra))

print(c)








0