# | Problem | Pass Rate (passed user / total user) |
---|---|---|
13333 | Stewie vs Brian |
|
13628 | Elsa's curse |
|
13679 | ZvP |
|
Description
Stewie and Brian are competing against each other in a game of partially filled sudoku.
The one who finishes it first wins.
Stewie can finish a 9x9 sudoku in 3 minutes.
Help Brian build a program so he can finish it before stewie.
Example of a solved sudoku:
Input
9x9 2d array with numbers ranging from 0 to 9
The 0 represents blank needed to be filled
Output
Solved 9x9 sudoku
If there's no solution, printt "no solution\n"
Sample Input Download
Sample Output Download
Tags
Discuss
Description
“W… Why did I…?”
Elsa crushed the paper in her hand, her eyes brimming with tears. Her grade on the I2P course has been marked with an F. She stormed into the raging blizzard, swearing not to return to programming again. Since then, the blizzard never seemed to cease.
Years passed, and the city of Arendrelle suffered from the everlasting winter caused by Elsa’s magic. To save the town, her sister Anna managed to reach Elsa’s ice castle. From what she had known from the trolls, the only way to stop Elsa’s magic is to make her reunite with programming again. Therefore, Anna decided to make Elsa a program that makes a snowflake from a number. Please help her make it.
A snowflake of order n is composed of the character ‘#’ and spaces. In the middle is the largest square, aka 'central square.' In each corner is a snowflake of order n-1 whose central square touches the main central square in its corner, and in the middle of each edge is a snowflake of order n-2 whose central square touches the main central square on its edge.
These snowflakes are 1 pixel apart from each other. (Look at Figure 1 for reference)
The smallest snowflake is of size 1×1 pixel, aka. order 1 snowflake.
The snowflake with size 0, although not a snowflake, is called order 0 by convention.
Remember to print '\n' at the end of every line.
Figure 1 Snowflakes of orders 1, 2, 3, 4, and 5.
To help you with some math, we provide you with the code for generating the size of the middle square and the cumulative sum of the square sizes up to order 7, as well as the size of the snowflake. You can try to verify the code by yourself.
Input
An integer n
1 < n < 7
Output
The snowflake of order n.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Teemothy never pays attention at class. He always plays Zombies vs Plants.
On a n x n garden grid, he plans to only use starfruits to shoot stars and kill the zombies.
But in this game, if a starfruit's star hit another starfruit's star (bullet), the other starfruit will die :(
Starfruit shoots star projectiles in five different directions, one up, one left, one right, one to the lower right, one to the lower left. like this:
Every grid in the garden has an integer X on it. For every starfruit you place on the garden, you get X points.
Help Teemothy to plant exactly n starfruits so that no starfruit would die (getting hit by its own bullets), and maximize his total points.
There might be no solution :D.
Input
The first line contains one integer n the length of the garden grid.
The following n lines contain n integers each, where each element is X
1 ≤ n ≤ 10
-109 ≤ X ≤ 109
Output
Print the maximum points.
If its impossible to put n starfruits in n xn grid, print "no solution".
Dont forget to put newline character.