Snake
You’ve decided to create the game Snake. To do that the first task you decide to tackle is to fill the whole
field with a snake - that would be the maximum possible score in the game.Given two integers
h
and w
, your program should print the field filled with the path of the snake.![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ff3eeee9d-07a0-440d-9ed6-27185968511c%2Fmaxresdefault.jpg?table=block&id=facbba21-a7de-45d2-9a15-4634f1952521&cache=v2)
Input | Output |
4 10 | 0 1 2 3 4 5 6 7 8 9
19 18 17 16 15 14 13 12 11 10
20 21 22 23 24 25 26 27 28 29
39 38 37 36 35 34 33 32 31 30 |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB