Image Scale X54034


Statement
 

pdf   zip

html

Input * N rows and M columns the image has. Values don’t have to be equal. * Sn, Sm scale up factor for the n rows and y columns respectively. It must be an integer and values don’t have to be equal. * Each line will be a row of the image. Each pixel will be an integer within the range 0 to 255 separated by a space.

Output The image value array scaled up.

Public test cases
  • Input

    3 4
    1 10
    1 1 1 1
    0 0 0 0
    1 1 1 1
    

    Output

    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
    
  • Input

    3 3
    3 3
    0 2 1
    0 2 1
    0 2 1
    

    Output

    0 0 0 2 2 2 1 1 1
    0 0 0 2 2 2 1 1 1
    0 0 0 2 2 2 1 1 1
    0 0 0 2 2 2 1 1 1
    0 0 0 2 2 2 1 1 1
    0 0 0 2 2 2 1 1 1
    0 0 0 2 2 2 1 1 1
    0 0 0 2 2 2 1 1 1
    0 0 0 2 2 2 1 1 1
    
  • Input

    10 10
    2 2
    1 2 3 4 5 6 7 8 9 10
    2 3 4 5 6 7 8 9 10 11
    3 4 5 6 7 8 9 10 11 12
    4 5 6 7 8 9 10 11 12 13
    5 6 7 8 9 10 11 12 13 14
    6 7 8 9 10 11 12 13 14 15
    7 8 9 10 11 12 13 14 15 16
    8 9 10 11 12 13 14 15 16 17
    9 10 11 12 13 14 15 16 17 18
    10 11 12 13 14 15 16 17 18 19
    

    Output

    1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10
    1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10
    2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11
    2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11
    3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12
    3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12
    4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13
    4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13
    5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14
    5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14
    6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15
    6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15
    7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16
    7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16
    8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17
    8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17
    9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18
    9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18
    10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19
    10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 
    
  • Input

    5 5
    5 5
    1 2 3 4 5
    2 3 4 5 4
    3 4 5 4 3
    4 5 4 3 2
    5 4 3 2 1
    

    Output

    1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5
    1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5
    1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5
    1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5
    1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5
    2 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

    2 5
    5 2
    1 2 3 4 5
    5 4 3 2 1
    

    Output

    1 1 2 2 3 3 4 4 5 5 
    1 1 2 2 3 3 4 4 5 5 
    1 1 2 2 3 3 4 4 5 5 
    1 1 2 2 3 3 4 4 5 5 
    1 1 2 2 3 3 4 4 5 5 
    5 5 4 4 3 3 2 2 1 1 
    5 5 4 4 3 3 2 2 1 1 
    5 5 4 4 3 3 2 2 1 1 
    5 5 4 4 3 3 2 2 1 1 
    5 5 4 4 3 3 2 2 1 1 
    
  • Input

    1 1
    8 3
    6
    

    Output

    6 6 6 
    6 6 6 
    6 6 6 
    6 6 6 
    6 6 6 
    6 6 6 
    6 6 6 
    6 6 6 
    
  • Input

    3 4
    10 1
    1 1 1 1
    0 0 0 0
    1 1 1 1
    

    Output

    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    0 0 0 0 
    0 0 0 0 
    0 0 0 0 
    0 0 0 0 
    0 0 0 0 
    0 0 0 0 
    0 0 0 0 
    0 0 0 0 
    0 0 0 0 
    0 0 0 0 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    1 1 1 1 
    
  • Information
    Author
    HP CodeWars
    Language
    English
    Official solutions
    Python
    User solutions
    C++ Java Python