Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Armed Bandit (Easy)

Limits 1s, 512 MB · Custom Checker

You are in a casino, and you are anxious to play on the new one-armed bandit – a slot machine they just installed.

The slot machine has n wheels in a row. The i-th wheel from the left contains the integers from 1 to ki, inclusive. When you pull the handle, the wheels will spin for a while. When they stop, each wheel will show you one of its integers. The integers are randomly chosen. All random choices are uniform and mutually independent.

You are given the number of wheels n and the size of every wheel ki.

You have to output any sequence of numbers you could see on the given slot machine.


The first line of the input file contains an integer t (t ≤ 100) specifying the number of test cases. Each test case is preceded by a blank line.

Each test case begins with a line consisting of a single integers n. The following line contains n space-separated integers k1, … , kn (1 ≤ n ≤ 1000, 1 ≤ ki ≤ 100).


For each test case, output a single line with n integers separated by single spaces: the numbers as they appear on the individual wheels of the machine.



6 6 6

10 2
2 4 6
7 2

This IPSC problem is licensed under the CC BY-SA 3.0 license. The problem statement has been modified slightly to adhere to Toph's style guide. The custom checker has been modified to be compatible with Toph.

You can find the original problem in the IPSC archive.



    98% Solution Ratio

    edge555Earliest, May '19

    MdriazkhanFastest, 0.0s

    MdriazkhanLightest, 0 B

    anonyo.akandShortest, 41B


    Login to submit

    Related Contests

    Toph uses cookies. By continuing you agree to our Cookie Policy.