問題一覧 > 通常問題

No.3221 Count Turns

レベル : / AI推定難易度 : 1600 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 60
作問者 : nauclhlt / テスター : 👑 p-adic
お気に入りにしたユーザー ProblemId : 12402 / 自分の提出
問題文最終更新日: 2025-08-01 22:06:44
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 476 (順位表) の他の問題:

Problem Statement

You are given a sequence $A=(A_1, A_2, \cdots, A_N)$ of length $N$.

There are also sequences $B=(B_1, B_2, \cdots, B_N), C=(C_1, C_2, \cdots, C_N)$ of length $N$, and initially all elements of $B, C$ are $0$. Consider the following operation on these sequences.

Operation:

  • As long as the maximum value of $B$ is less than $H$, repeat the following:
    • For every $i$ satisfying $1\leq i\leq N$, set $B_i\leftarrow B_i+A_i$.
  • Then, letting $M$ be the maximum value of $B$, for the smallest $i$ satisfying $B_i=M\ (1\leq i\leq N)$, set $B_i\leftarrow 0$ and $C_i\leftarrow C_i+1$.

Find each value of $C$ after performing the operation exactly $T$ times in succession.

Input

$N$ $H$ $T$
$A_1\ A_2\ \cdots\ A_N$
  • $1\leq N\leq 10^5$
  • $1\leq H\leq 10^8$
  • $1\leq T\leq 10^5$
  • $1\leq A_i\lt H$
  • All inputs are integers.

Output

Print $C$ after exactly the $T$-th operation has finished, on $1$ line in the following format.

$C_1\ C_2\ \cdots\ C_N$

Print a newline at the end.

Sample

Sample 1
Input
2 8 7
2 3
Output
3 4
  • After the $1$st operation, $B=(6, 0), C=(0, 1)$
  • After the $2$nd operation, $B=(0, 3), C=(1, 1)$
  • After the $3$rd operation, $B=(4, 0), C=(1, 2)$
  • After the $4$th operation, $B=(0, 6), C=(2, 2)$
  • After the $5$th operation, $B=(2, 0), C=(2, 3)$
  • After the $6$th operation, $B=(8, 0), C=(2, 4)$
  • After the $7$th operation, $B=(0, 0), C=(3, 4)$

Therefore, $C=(3, 4)$ is the answer.

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