Generating a grid X52952


Statement
 

pdf   zip

html

Write a program that, given triples of positive natural numbers n, m, side generates grids with n×m squares with side side as those shown in the examples.

Input

An arbitrary number of cases, each of them consisting of three positive natural numbers n, m, side on one line.

Output

For each case, the corresponding grid followed by a blank line.

Observation

You can generate the output character by character or with strings built previously, it’s up to you.

Assessment over 10 points:

  • Slow solution: 5 points.
  • Fast solution: 10 points.

We understand as fast solution one being correct, with linear cost and able to overcome both the public and private tests. We understand as slow solution one not being fast, but correct and able to overcome the public tests.

Public test cases
  • Input

    2 2 2
    3 1 3
    1 3 1
    1 1 5
    8 7 2
    4 2 4
    3 5 2
    6 3 4
    3 4 4
    7 5 3
    5 1 4
    1 8 2
    7 3 3
    4 4 4
    2 3 3
    3 6 4
    2 1 4
    3 6 2
    6 8 1
    2 7 1
    4 3 2
    7 4 1
    5 2 3
    3 5 2
    

    Output

    #######
    #  #  #
    #  #  #
    #######
    #  #  #
    #  #  #
    #######
    
    #####
    #   #
    #   #
    #   #
    #####
    #   #
    #   #
    #   #
    #####
    #   #
    #   #
    #   #
    #####
    
    #######
    # # # #
    #######
    
    #######
    #     #
    #     #
    #     #
    #     #
    #     #
    #######
    
    ######################
    #  #  #  #  #  #  #  #
    #  #  #  #  #  #  #  #
    ######################
    #  #  #  #  #  #  #  #
    #  #  #  #  #  #  #  #
    ######################
    #  #  #  #  #  #  #  #
    #  #  #  #  #  #  #  #
    ######################
    #  #  #  #  #  #  #  #
    #  #  #  #  #  #  #  #
    ######################
    #  #  #  #  #  #  #  #
    #  #  #  #  #  #  #  #
    ######################
    #  #  #  #  #  #  #  #
    #  #  #  #  #  #  #  #
    ######################
    #  #  #  #  #  #  #  #
    #  #  #  #  #  #  #  #
    ######################
    #  #  #  #  #  #  #  #
    #  #  #  #  #  #  #  #
    ######################
    
    ###########
    #    #    #
    #    #    #
    #    #    #
    #    #    #
    ###########
    #    #    #
    #    #    #
    #    #    #
    #    #    #
    ###########
    #    #    #
    #    #    #
    #    #    #
    #    #    #
    ###########
    #    #    #
    #    #    #
    #    #    #
    #    #    #
    ###########
    
    ################
    #  #  #  #  #  #
    #  #  #  #  #  #
    ################
    #  #  #  #  #  #
    #  #  #  #  #  #
    ################
    #  #  #  #  #  #
    #  #  #  #  #  #
    ################
    
    ################
    #    #    #    #
    #    #    #    #
    #    #    #    #
    #    #    #    #
    ################
    #    #    #    #
    #    #    #    #
    #    #    #    #
    #    #    #    #
    ################
    #    #    #    #
    #    #    #    #
    #    #    #    #
    #    #    #    #
    ################
    #    #    #    #
    #    #    #    #
    #    #    #    #
    #    #    #    #
    ################
    #    #    #    #
    #    #    #    #
    #    #    #    #
    #    #    #    #
    ################
    #    #    #    #
    #    #    #    #
    #    #    #    #
    #    #    #    #
    ################
    
    #####################
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #####################
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #####################
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #####################
    
    #####################
    #   #   #   #   #   #
    #   #   #   #   #   #
    #   #   #   #   #   #
    #####################
    #   #   #   #   #   #
    #   #   #   #   #   #
    #   #   #   #   #   #
    #####################
    #   #   #   #   #   #
    #   #   #   #   #   #
    #   #   #   #   #   #
    #####################
    #   #   #   #   #   #
    #   #   #   #   #   #
    #   #   #   #   #   #
    #####################
    #   #   #   #   #   #
    #   #   #   #   #   #
    #   #   #   #   #   #
    #####################
    #   #   #   #   #   #
    #   #   #   #   #   #
    #   #   #   #   #   #
    #####################
    #   #   #   #   #   #
    #   #   #   #   #   #
    #   #   #   #   #   #
    #####################
    
    ######
    #    #
    #    #
    #    #
    #    #
    ######
    #    #
    #    #
    #    #
    #    #
    ######
    #    #
    #    #
    #    #
    #    #
    ######
    #    #
    #    #
    #    #
    #    #
    ######
    #    #
    #    #
    #    #
    #    #
    ######
    
    #########################
    #  #  #  #  #  #  #  #  #
    #  #  #  #  #  #  #  #  #
    #########################
    
    #############
    #   #   #   #
    #   #   #   #
    #   #   #   #
    #############
    #   #   #   #
    #   #   #   #
    #   #   #   #
    #############
    #   #   #   #
    #   #   #   #
    #   #   #   #
    #############
    #   #   #   #
    #   #   #   #
    #   #   #   #
    #############
    #   #   #   #
    #   #   #   #
    #   #   #   #
    #############
    #   #   #   #
    #   #   #   #
    #   #   #   #
    #############
    #   #   #   #
    #   #   #   #
    #   #   #   #
    #############
    
    #####################
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #####################
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #####################
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #####################
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #    #    #    #    #
    #####################
    
    #############
    #   #   #   #
    #   #   #   #
    #   #   #   #
    #############
    #   #   #   #
    #   #   #   #
    #   #   #   #
    #############
    
    ###############################
    #    #    #    #    #    #    #
    #    #    #    #    #    #    #
    #    #    #    #    #    #    #
    #    #    #    #    #    #    #
    ###############################
    #    #    #    #    #    #    #
    #    #    #    #    #    #    #
    #    #    #    #    #    #    #
    #    #    #    #    #    #    #
    ###############################
    #    #    #    #    #    #    #
    #    #    #    #    #    #    #
    #    #    #    #    #    #    #
    #    #    #    #    #    #    #
    ###############################
    
    ######
    #    #
    #    #
    #    #
    #    #
    ######
    #    #
    #    #
    #    #
    #    #
    ######
    
    ###################
    #  #  #  #  #  #  #
    #  #  #  #  #  #  #
    ###################
    #  #  #  #  #  #  #
    #  #  #  #  #  #  #
    ###################
    #  #  #  #  #  #  #
    #  #  #  #  #  #  #
    ###################
    
    #################
    # # # # # # # # #
    #################
    # # # # # # # # #
    #################
    # # # # # # # # #
    #################
    # # # # # # # # #
    #################
    # # # # # # # # #
    #################
    # # # # # # # # #
    #################
    
    ###############
    # # # # # # # #
    ###############
    # # # # # # # #
    ###############
    
    ##########
    #  #  #  #
    #  #  #  #
    ##########
    #  #  #  #
    #  #  #  #
    ##########
    #  #  #  #
    #  #  #  #
    ##########
    #  #  #  #
    #  #  #  #
    ##########
    
    #########
    # # # # #
    #########
    # # # # #
    #########
    # # # # #
    #########
    # # # # #
    #########
    # # # # #
    #########
    # # # # #
    #########
    # # # # #
    #########
    
    #########
    #   #   #
    #   #   #
    #   #   #
    #########
    #   #   #
    #   #   #
    #   #   #
    #########
    #   #   #
    #   #   #
    #   #   #
    #########
    #   #   #
    #   #   #
    #   #   #
    #########
    #   #   #
    #   #   #
    #   #   #
    #########
    
    ################
    #  #  #  #  #  #
    #  #  #  #  #  #
    ################
    #  #  #  #  #  #
    #  #  #  #  #  #
    ################
    #  #  #  #  #  #
    #  #  #  #  #  #
    ################
    
    
  • Information
    Author
    PRO1
    Language
    English
    Translator
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    C++
    User solutions
    C++