結果

問題 No.2566 美しい整数列
ユーザー titiatitia
提出日時 2023-12-16 03:27:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 710 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 100,492 KB
最終ジャッジ日時 2023-12-16 03:27:27
合計ジャッジ時間 13,357 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,112 KB
testcase_01 AC 27 ms
10,112 KB
testcase_02 AC 26 ms
10,112 KB
testcase_03 AC 28 ms
10,112 KB
testcase_04 AC 710 ms
99,652 KB
testcase_05 AC 704 ms
100,492 KB
testcase_06 AC 398 ms
62,108 KB
testcase_07 AC 381 ms
60,624 KB
testcase_08 AC 415 ms
59,744 KB
testcase_09 AC 388 ms
60,368 KB
testcase_10 AC 395 ms
61,008 KB
testcase_11 AC 498 ms
68,300 KB
testcase_12 AC 476 ms
69,896 KB
testcase_13 AC 480 ms
68,692 KB
testcase_14 AC 493 ms
68,300 KB
testcase_15 AC 479 ms
68,296 KB
testcase_16 AC 654 ms
93,600 KB
testcase_17 AC 613 ms
88,124 KB
testcase_18 AC 664 ms
91,072 KB
testcase_19 AC 401 ms
61,264 KB
testcase_20 AC 602 ms
84,852 KB
testcase_21 AC 594 ms
89,848 KB
testcase_22 AC 385 ms
54,924 KB
testcase_23 AC 513 ms
75,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

while len(B)<N+1:
    B+=B

S=[0]
for b in B:
    S.append(S[-1]+b)

D=dict()

for i in range(N):
    k=A[i]-S[i]
    if k in D:
        D[k].append(i)
    else:
        D[k]=[i]

SUM=sum(C)

ANS=1<<60

for k in D:
    score=0
    for x in D[k]:
        score+=C[x]

    ANS=min(ANS,SUM-score)

print(ANS)
0