2893 - I2P(I)2023_Hu_Lab6 Scoreboard

Time

2023/11/06 18:30:00 2023/11/06 20:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
14025 Let the Queen cooks
14039 Capybara Hunts!

14025 - Let the Queen cooks   

Description

I loved the part when she said “It’s cooking time!” And cooks everywhere, it really shows that she really cooks all the time.

Pin on Bakery logo design

Given a n x n board, each tile is either 1 or 0, you need to put n queens and count how many solutions are legal as the rules:

  • 0 means you can put the queen in that tile.
  • 1 means the tile is occupied, and we can't put the queen there.
  •  Queens can't attack each other, therefore each row, column, and diagonal has only 1 queen.

For example, the answer of the sample input is 1 as the picture below speaks for itself. There is no other possible move.

Little help from the queen: use scanf("%1d") to scan 1 digit number.

Input

First line is an integer n (1 <= n <= 10)

The next n lines is the board state, each n digit, consist only number 1 and 0.

It's guaranteed that every row has atleast 1 number 0

Output

Output an integer with how many solution the input has.

Following with '\n'

Sample Input  Download

Sample Output  Download

Tags




Discuss




14039 - Capybara Hunts!   

Description

Capybara-san loves high-quality meat (vegan-friendly) imported from the USA!

He wants to find meat in the maze.

  • '.' is a path
  • '#' is a wall
  • 'S' is his starting point
  • 'M' is the meat

If Capybara-san is at position (x, y), then he can walk to:

  • (x + 1, y)
  • (x - 1, y)
  • (x, y + 1)
  • (x, y - 1)

​All 4 movements are counted by 1 step, and also valid if that position is not a wall

How many steps does he need to walk?

The maze is made as:

  • For every position (a, b) and (c, d), where (a, b) ≠ (c, d), there is only 1 path solution from (a, b) to (c, d)

Input

The first input is X, and Y (X is row, Y is column) of the map
The next input is X * Y map,

5 <= X, Y <= 300
It's guaranteed that there is always S, M, and a path between that 2 points

Output

Output the steps, following with a newline

Sample Input  Download

Sample Output  Download

Tags




Discuss