Sicily 7148. Magic Traps

这是一道关于识别魔法陷阱的问题,公园被分为多个区块,魔法陷阱由连接的区块组成。题目要求计算出公园中魔法陷阱的种类分布,包括矩形、圆形和三角形。输入包含公园的布局信息,需要处理的陷阱形状不规则,但必须保持连通且不受破坏。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

7148. Magic Traps

Constraints

Time Limit: 1 secs, Memory Limit: 256 MB

Description

Rikka is fighting against Priestess in a park now, but it seems that she almost fails. The only thing she can do is to launch the magic traps which were deployed before. Each trap belongs to one of the three categories: rectangle, circle and triangle. Different categories of traps need different magic spells to launch. So Rikka must quickly understand how many traps of each category are there. Unfortunately, it's hard to understand what this trap category is for Rikka, so she needs your help.

To simplify the problem, we assume that the park is a large rectangle and divided into N*M blocks. A magic trap is combined by several connected blocks. Two blocks connect each other if and only if they share either an edge or a point. A block is said to be magic if it is part of a trap.

Because of her great power, Priestess can break some magic blocks so that they are not magic any more. Priestess can break a magic block only if it shares edges with at least two other magic blocks. For example, in the following figure, assume that block 1, 2, 3, 4, and 5 are all magic, while block 6 is not. Then block 5 cannot be broken because it shares an edge with only one magic block (block 3). Priestess can break one of block 1, 2, 3, or 4; however, she cannot break both block 1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值