結果

問題 No.2566 美しい整数列
コンテスト
ユーザー LyricalMaestro
提出日時 2025-11-05 23:20:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 243 ms / 2,000 ms
コード長 504 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 82,704 KB
実行使用メモリ 156,992 KB
最終ジャッジ日時 2025-11-05 23:20:13
合計ジャッジ時間 7,447 ms
ジャッジサーバーID
(参考情報)
judge1 / judge7
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

## https://yukicoder.me/problems/no/2866


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

    b = 0
    a_map = {}
    for i in range(N):
        a = A[i] - b
        if a not in a_map:
            a_map[a] = 0
        a_map[a] += C[i]

        b += B[i % M]
    
    sum_c = sum(C)
    max_c = max(a_map.values())
    print(sum_c - max_c)



if __name__ == "__main__":
    main()
0