問題一覧 > 通常問題

No.3041 Asymmetric Rock-Paper-Scissors

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

Story

nauclhlt became curious about how many different values the total number of fingers can take when playing rock-paper-scissors.

It is not clear whether a game whose available hands have no symmetry can be called rock-paper-scissors, but he does not care.

Problem Statement

$N$ people, each having exactly $F$ fingers on their hand, play rock-paper-scissors.
Playing rock-paper-scissors means that each person independently chooses one of three hands and shows it.
Person $i(1\leq i\leq N)$ can choose the hand to show from the following three hands.

  • Hand 1: Raise $A_i$ fingers
  • Hand 2: Raise $B_i$ fingers
  • Hand 3: Raise $C_i$ fingers

For an integer $n(1\leq n\leq N)$, define $f(n)$ as follows.

  • The number of non-negative integers that can be the sum of the numbers of raised fingers when the $n$ people, persons $1, 2, \cdots, n$, play rock-paper-scissors

For example, when $N=2, F=5, A=(0, 0), B=(2, 2), C=(5, 5)$, we have $f(1)=3, f(2)=6$.

Given $F, A, B, C$ and a positive integer $N$, find $f(k)$ for $k=1, 2, \cdots, N$.

Input

$N\ F$
$A_1\ A_2\ \cdots\ A_N$
$B_1\ B_2\ \cdots\ B_N$
$C_1\ C_2\ \cdots\ C_N$
  • $1\leq N\leq 1.5\times 10^4$
  • $1\leq F\leq 60$
  • $0\leq A_i, B_i, C_i\leq F$

Output

Print $N$ lines. On the $k(1\leq k\leq N)$-th line, print the value of $f(k)$.
Print a newline at the end.

Sample

Sample 1
Input
3 5
0 0 0
2 2 2
5 5 5
Output
3
6
10

This is ordinary rock-paper-scissors.

  • When person 1 plays rock-paper-scissors, the possible numbers of raised fingers are the $3$ values $0, 2, 5$.
  • When persons 1, 2 play rock-paper-scissors, the possible numbers of raised fingers are the $6$ values $0, 2, 4, 5, 7, 10$.
  • When persons 1, 2, 3 play rock-paper-scissors, the possible numbers of raised fingers are the $10$ values $0, 2, 4, 5, 6, 7, 9, 10, 12, 15$.

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