Under construction

Still being built. Things may change

Histogram

Interview

Time limit1sMemory limit1024 MB

Summary
Given bin size, bin count, and data points, count how many points fall in each bin and print a histogram with # bars on a - base.
Level

Easy3 of 10

Topics
Array, Implementation, Simulation, Math
Solved
No attempts yet

Problem

The term "histogram" was first introduced in 1895 by Karl Pearson. This is also the year that the portable electric drill was invented. It may not be a coincidence that we speak about "data drilling" today. Most things back then were not electric however, and histograms were still hand crafted. Nowadays, we like things electric and automated. The Bureaucratic Affiliation for Printing Charts needs to create a lot of histograms for a lot of data points, so they come to you for help to automate the printing of histograms.

Given a list of data points, print a histogram.

Input

The input consists of:

  • One line containing three integers nn, ss, and kk (1≤n,s,k≤10001 \leq n, s, k \leq 1000), the number of bins, the size per bin, and the number of data points, respectively.
  • One line containing kk integer data points xx (1≤x≤n⋅s1 \leq x \leq n \cdot s).

Output

Output the histogram. That is, write a rectangle of characters. The rectangle should be as wide as the number of bins. Each column of the rectangle should have

  • a "-" at the bottom;
  • on top of that, as many "#" as there are items in the bin;
  • on top of that, as many "." as are needed to fill out the rectangle.

The rectangle should be just high enough to display a "#" for each element in every bin, but no higher.

Examples3

  1. Example 1

    Input
    3 1 6
    1 2 3 2 1 2
    
    Expected output
    .#.
    ##.
    ###
    ---
    
  2. Example 2

    Input
    3 10 5
    1 9 11 29 24
    
    Expected output
    #.#
    ###
    ---
    
  3. Example 3

    Input
    6 10 5
    19 20 21 42 42
    
    Expected output
    .#..#.
    .##.#.
    ------