問題一覧 > 通常問題

No.1977 Extracting at Constant Intervals

レベル : / AI推定難易度 : 1900 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 25
作問者 : magsta / テスター : tassei903
お気に入りにしたユーザー ProblemId : 8121 / 自分の提出
問題文最終更新日: 2022-06-10 12:46:49
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 347 (順位表) の他の問題:

Problem Statement

You are given an integer sequence $A_1,A_2,\dots,A_N$ consisting of $N$ elements, and integers $M,L$.

Let $B$ be the sequence of length $NM$ formed by concatenating $M$ copies of the integer sequence $A$.


Consider choosing $i$ satisfying $1 \leq i \leq L$. Then, $C_i$ is defined as follows.

  • The sum of $B_j$ over all $j$ satisfying $j \equiv i \pmod L, 1 \leq j \leq NM$
  • Find the maximum value of $C_i$.

    Constraints

    • $\displaystyle 1 \leq N \leq 10^5$
    • $\displaystyle 1 \leq M \leq 10^9$
    • $\displaystyle 1 \leq L \leq NM$
    • $\displaystyle -10^4 \leq A_i \leq 10^4 \ (1 \leq i \leq N)$
    • All input values are integers

    Input

    $N\ \ M\ \ L$
    $A_1\ \ A_2\ \ \dots\ \ A_N$
    

    Output

    Output the value you found, followed by a newline.

    Sample

    Sample 1
    Input
    5 2 3
    4 -6 3 5 -1
    Output
    12

    The sequence $B$ is $B={4,-6,3,5,-1,4,-6,3,5,-1}$.

    We have $C_1=2,C_2=-4,C_3=12$, and the maximum value is $12$.

    Sample 2
    Input
    2 3 4
    -1 -2
    Output
    -1

    提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。