
67  ZOJ Monthly, June 2008  1002
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. Input Each line of the input file will be 3 single positive numbers n, p, q You may assume that 0 < n, p , q < 5000. Output 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 NO YES 3 5 3 3 5 3 Author: ZHANG, Rui 