This page is still under construction.

Parts of this page are still being built. What you see may change.

Klothes

Time limit1sMemory limit512 MB

Summary
Given n, s, k, decide whether k distinct prices from 1 to n can sum to s, and if so print one such subset as a bit string.
Level

Medium6 of 10

Topics
Greedy, Math, Implementation, Combinatorics
Solved
No attempts yet

Problem

What an unsmurfy day! Smurfette just found out that someone (probably Jokey Smurf) has stolen all of her clothes and she'll need to buy new ones. There are nn sets of clothes in the shop each having different integer price from 11 to nn smurfcoins. Since smurfiness of an article of clothing is proportional to its price Smurfette wants to spend all of her ss smurfcoins. However her wardrobe will fit only kk clothes so she needs to buy exactly kk (having empty places in a wardrobe is bad for her image).

Input

First line of input file contains the number of testcases tt (t≤8000t \leq 8000). Each testcase consists of a single line containing three integers nn, ss, and kk (1≤k≤n≤40 0001 \leq k \leq n \leq 40\,000, 0≤s≤1090 \leq s \leq 10^9). nn is the number of clothes available in the shop, kk is the number of clothes Smurfette wants to buy, and ss is the amount of smurfcoins she wants to spend.

Output

For each testcase output on a single line the word "YES" (without quotes) if it is possible to buy kk clothes so that their price is ss, or "NO" otherwise. If the answer is "YES" then on the following line output a string of nn digits aia_i. aia_i should be 11 if Smurfette should buy article of clothing with price ii, otherwise aia_i should be 00.

Examples1

  1. Example 1

    Input
    3
    3 6 2
    5 7 3
    1 1 1
    
    Expected output
    NO
    YES
    11010
    YES
    1