結果

問題 No.2488 Mod Sum Maximization
ユーザー shotoyooshotoyoo
提出日時 2023-10-01 10:43:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 855 bytes
コンパイル時間 2,699 ms
コンパイル使用メモリ 86,712 KB
実行使用メモリ 128,572 KB
最終ジャッジ日時 2023-10-01 10:43:45
合計ジャッジ時間 8,455 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
72,180 KB
testcase_01 AC 92 ms
71,892 KB
testcase_02 AC 93 ms
72,056 KB
testcase_03 WA -
testcase_04 AC 167 ms
128,072 KB
testcase_05 WA -
testcase_06 AC 166 ms
122,876 KB
testcase_07 WA -
testcase_08 AC 170 ms
123,416 KB
testcase_09 AC 152 ms
113,132 KB
testcase_10 WA -
testcase_11 AC 101 ms
77,848 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 140 ms
105,152 KB
testcase_16 AC 104 ms
78,160 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 161 ms
117,564 KB
testcase_20 AC 157 ms
118,052 KB
testcase_21 AC 157 ms
117,864 KB
testcase_22 AC 162 ms
122,880 KB
testcase_23 AC 164 ms
123,360 KB
testcase_24 WA -
testcase_25 AC 100 ms
78,088 KB
testcase_26 WA -
testcase_27 AC 136 ms
99,732 KB
testcase_28 AC 143 ms
99,416 KB
testcase_29 AC 133 ms
99,868 KB
testcase_30 AC 126 ms
90,852 KB
testcase_31 AC 103 ms
78,972 KB
testcase_32 AC 155 ms
117,308 KB
testcase_33 AC 96 ms
77,380 KB
testcase_34 AC 159 ms
122,720 KB
testcase_35 AC 118 ms
89,580 KB
testcase_36 AC 94 ms
72,284 KB
testcase_37 AC 90 ms
71,920 KB
testcase_38 AC 90 ms
71,752 KB
testcase_39 AC 91 ms
72,284 KB
testcase_40 AC 95 ms
71,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, random
input = lambda : sys.stdin.readline().rstrip()


write = lambda x: sys.stdout.write(x+"\n"); writef = lambda x: print("{:.12f}".format(x))
debug = lambda x: sys.stderr.write(x+"\n")
YES="Yes"; NO="No"; pans = lambda v: print(YES if v else NO); INF=10**18
LI = lambda : list(map(int, input().split())); II=lambda : int(input()); SI=lambda : [ord(c)-ord("a") for c in input()]
def debug(_l_):
    for s in _l_.split():
        print(f"{s}={eval(s)}", end=" ")
    print()
def dlist(*l, fill=0):
    if len(l)==1:
        return [fill]*l[0]
    ll = l[1:]
    return [dlist(*ll, fill=fill) for _ in range(l[0])]

n = int(input())
a = list(map(int, input().split()))
res = -a[-1] + a[-1]%a[0]
cum = -INF
for i in range(1,n-1):
    cum = max(cum, -a[-1] + a[-1]%a[i])
    val = -a[i] + a[i]%a[0]
    res = max(res, val+cum)
print(sum(a)+res)
0