結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 67 ms
72,056 KB
testcase_02 AC 69 ms
71,884 KB
testcase_03 AC 68 ms
71,700 KB
testcase_04 AC 107 ms
77,948 KB
testcase_05 AC 105 ms
77,920 KB
testcase_06 AC 73 ms
71,968 KB
testcase_07 AC 534 ms
78,316 KB
testcase_08 AC 127 ms
77,752 KB
testcase_09 AC 103 ms
76,756 KB
testcase_10 AC 149 ms
77,908 KB
testcase_11 AC 146 ms
77,932 KB
testcase_12 AC 71 ms
71,756 KB
testcase_13 AC 174 ms
77,884 KB
testcase_14 AC 73 ms
71,972 KB
testcase_15 AC 93 ms
76,792 KB
testcase_16 AC 241 ms
78,108 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2,005 ms
79,432 KB
testcase_21 AC 959 ms
79,268 KB
testcase_22 AC 586 ms
78,576 KB
testcase_23 AC 571 ms
78,528 KB
testcase_24 AC 632 ms
78,704 KB
testcase_25 AC 589 ms
78,216 KB
testcase_26 WA -
testcase_27 AC 1,577 ms
78,848 KB
testcase_28 AC 2,289 ms
79,840 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 191 ms
79,272 KB
testcase_33 AC 676 ms
78,552 KB
testcase_34 AC 673 ms
78,408 KB
testcase_35 AC 2,388 ms
79,832 KB
testcase_36 AC 2,388 ms
79,396 KB
testcase_37 AC 2,381 ms
80,012 KB
testcase_38 AC 2,387 ms
79,940 KB
testcase_39 AC 72 ms
71,972 KB
testcase_40 AC 95 ms
76,704 KB
testcase_41 AC 74 ms
71,912 KB
testcase_42 AC 75 ms
71,744 KB
testcase_43 AC 84 ms
77,044 KB
testcase_44 AC 103 ms
76,708 KB
testcase_45 AC 73 ms
71,980 KB
testcase_46 AC 94 ms
76,984 KB
testcase_47 AC 595 ms
78,012 KB
testcase_48 AC 579 ms
78,232 KB
testcase_49 WA -
testcase_50 AC 588 ms
78,360 KB
testcase_51 AC 515 ms
78,432 KB
testcase_52 WA -
testcase_53 AC 515 ms
78,160 KB
testcase_54 AC 91 ms
76,864 KB
testcase_55 AC 67 ms
71,976 KB
testcase_56 AC 69 ms
72,004 KB
testcase_57 AC 70 ms
71,704 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