Proton Impact cannon

Source: Internet
Author: User

"Title description"

Allied scientists found that the proton impact cannon has an energy transfer characteristics, the proton energy will make the fence chain reaction, a series of explosions, will be in the upper and lower left and right four directions (no oblique direction) to produce a little splash damage, if the fence is connected in four directions, will be blown together, four directions are caused by 1 points of sputtering damage. This topic has made some improvements to the proton shells, which will be read into a 5*5 damage matrix, which is the center of the landing point.

"Input description"

First line: N (n <= 20);

2nd to n+1: A n*n topographic map of the enemy;

Next five elements: a 5*5 damage matrix (3,3) as the center, that is, the landing point;

Next five elements: the center of the landing point of the V-rounds (x, y).

(in N*n's enemy topographic map, 0 means open space, 1 represents the fence, and 1~9 represents the building's blood volume.) )

"Output description"

Two numbers, the first to destroy the number of buildings, the second to destroy the number of walls.

"Sample Input"

5

0 0 1) 4 1

-1-1-1-1-1

-1 2 1 0 4

1 9 4) 2 1

0 0 0) 0 0

0 0 0) 0 0

0 1 1) 1 0

0 1 2) 1 0

0 1 1) 1 0

0 0 0) 0 0

2 3

4 4

5 3

3 4

5 5

"Sample Output"

9

6

"Data range and Tips"

Sample Resolution: X indicates a building explosion, y indicates a wall explosion.

First cannon:

0 0 x 3 x

Y y x y y y

Y x x 0 3

X 8 3 2 1

0 0 0) 0 0

Second gun:

0 0 x 3 x

Y y x y y y

Y x x 0 2

X 8 2 x x

0 0 0) 0 0

Third cannon:

0 0 x 3 x

Y y x y y y

Y x x 0 x

X 8 2 x x

0 0 0) 0 0

Four cannon:

0 0 x 3 x

Y y x y y y

Y x x 0 x

x 7 x x x

0 0 0) 0 0

V Cannon:

0 0 x 3 x

Y y x y y y

Y x x 0 x

x 7 x x x

0 0 0) 0 0

Proton Impact cannon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.