Welcome to ZOJ
Select Problem
ZOJ Problem Set - 2997
Black and White

Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge

Write a program which reads three positive integers n, p, q. Decide whether or not there exists a sequence of n integers such that the sum of any p consecutive elements is positive and the sum of any q consecutive ones is negative. If the answer is YES, your program has to produce such a sequence.


Each line of the input file will be 3 single positive numbers n, p, q You may assume that 0 < n, p , q < 5000.


The output consists of NO or YES followed by a sequence of n integers written on display.

Sample Input

4 2 3
6 5 3

Sample Output

-3 5 -3 -3 5 -3

Author: ZHANG, Rui
Source: ZOJ Monthly, June 2008
Submit    Status