QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 256 MB Points totaux : 100

#12366. XCPC

Statistiques

In the "XCPC" competition series, there are four types of medals: gold, silver, bronze, and iron, with values of $4, 3, 2, 1$ respectively. In this problem, $2$ iron medals can be combined into $1$ bronze medal, $2$ bronze medals can be combined into $1$ silver medal, and $2$ silver medals can be combined into $1$ gold medal.

You currently have $n$ iron medals. You can perform combinations to change the number of medals you possess. Let the quadruple $(a_1, a_2, a_3, a_4)$ represent the number of gold, silver, bronze, and iron medals, respectively.

Please answer $n$ questions, where the $i$-th question ($1 \le i \le n$) is: * Given that you start with exactly $n$ iron medals, how many distinct quadruples $(a_1, a_2, a_3, a_4)$ are possible such that: (1) the total number of medals is $i$, i.e., $a_1 + a_2 + a_3 + a_4 = i$; (2) the total value of the medals is at least $p$, i.e., $4a_1 + 3a_2 + 2a_3 + a_4 \ge p$. Here, $p$ is given as input.

Two quadruples are considered different if and only if they differ in at least one corresponding position.

Input

The first line contains two integers $n, p$ ($1 \le p \le n \le 10^6$), separated by a space, representing the initial number of iron medals and the required total medal value $p$, respectively.

Output

Output a single line containing $n$ integers, separated by spaces, where the $i$-th integer ($1 \le i \le n$) represents the answer to the $i$-th question.

Examples

Input 1

8 7

Output 1

0 0 1 2 2 1 1 1

Input 2

10 8

Output 2

0 0 1 2 2 2 2 1 1 1

Input 3

12 1

Output 3

0 1 2 2 3 3 2 2 2 1 1 1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.