您当前的位置: 首页 > 

HeartFireY

暂无认证

  • 1浏览

    0关注

    334博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

HDU4499 Canon 爆搜DFS题解

HeartFireY 发布时间:2021-01-24 12:14:13 ,浏览量:1

原题

Problem Description

In Chinese Chess, there is one kind of powerful chessmen called Cannon. It can move horizontally or vertically along the chess grid. At each move, it can either simply move to another empty cell in the same line without any other chessman along the route or perform an eat action. The eat action, however, is the main concern in this problem. An eat action, for example, Cannon A eating chessman B, requires two conditions: 1、A and B is in either the same row or the same column in the chess grid. 2、There is exactly one chessman between A and B. Here comes the problem. Given an N x M chess grid, with some existing chessmen on it, you need put maximum cannon pieces into the grid, satisfying that any two cannons are not able to eat each other. It is worth nothing that we only account the cannon pieces you put in the grid, and no two pieces shares the same cell.

Input

There are multiple test cases. In each test case, there are three positive integers N, M and Q (1 n >> m >> q, n, m, q){ memset(g, 0, sizeof(g)); ans = 0; for(int i = 0; i > x >> y; g[x][y] = 1; } dfs(0, 0, 0); cout

关注
打赏
1662600635
查看更多评论
立即登录/注册

微信扫码登录

0.0398s