HDOJ 4770 Lights Against Dudely】的更多相关文章

状压+暴力搜索 Lights Against Dudely Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 178    Accepted Submission(s): 57 Problem Description Harry: "But Hagrid. How am I going to pay for all of this? I h…
题目传送门 题意:有n*m的房间,'.'表示可以被点亮,'#'表示不能被点亮,每点亮一个房间会使旁边的房间也点亮,有意盏特别的灯可以选择周围不同方向的房间点亮.问最少需要多少灯使得所有房间点亮 分析:需要被点亮的房间最多只有15个,所以考虑状压,然后暴力枚举选择哪一个当作特殊灯和枚举选择哪个方向使旁边的房间亮,注意清空vis数组需要优化,memset超时.上交6分钟1Y,Orz...额,看错榜了,最快的19分钟,而且这不是第一道水题,汗 /****************************…
pid=4770" target="_blank" style="">题目链接:hdu 4770 Lights Against Dudely 题目大意:在一个N*M的银行里.有N*M个房间,'#'代表牢固的房间,'.'代表的是脆弱的房间.脆弱的房间个数不会超过15个,如今为了确保安全,要在若干个脆弱的房间上装灯.普通的灯是照亮{0, 0}, {-1, 0}, {0, 1}(和题目中坐标有点出入).然后能够装一个特殊的,能够照耀 { {0, 0}, {…
又一发吐血ac,,,再次明白了用函数(代码重用)和思路清晰的重要性. 11779687 2014-10-02 20:57:53 Accepted 4770 0MS 496K 2976 B G++ czy Lights Against Dudely Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1360    Accepted Subm…
Lights Against Dudely Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Harry: "But Hagrid. How am I going to pay for all of this? I haven't any money." Hagrid: "Well there's your money,…
Lights Against Dudely Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 171    Accepted Submission(s): 53 Problem Description Harry: "But Hagrid. How am I going to pay for all of this? I haven't a…
思路: 这个题完全就是暴力的,就是代码长了一点. 用到了状压,因为之前不知道状压是个东西,大佬们天天说,可是我又没学过,所以对状压有一点阴影,不过这题中的状压还是蛮简单的. 枚举所有情况,取开灯数最少的. 解释都在注释之中了. #include<iostream> #include<algorithm> #include<vector> #include<stack> #include<queue> #include<map> #in…
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=4770 Lights Against Dudely Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2021    Accepted Submission(s): 595 Problem Description Harry: "But Hag…
Lights Against Dudely Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 525    Accepted Submission(s): 157 Problem Description Harry: "But Hagrid. How am I going to pay for all of this? I haven't…
称号:hdu4770:Lights Against Dudely 题目大意:相同是n*m的矩阵代表room,房间相同也有脆弱和牢固之分,如今要求要保护脆弱的房间.须要将每一个脆弱的房间都照亮,可是牢固的房间不同意照到灯. 灯是成L形的,即在x,y上有一盏灯,那么(x - 1, y)和(x. y + 1)就能够被照亮.当然包含(x.y).题目又提供了一盏特殊的灯,它能够该改变方向.可是仅仅有一盏,能够用也能够不用.一个房间最多一盏灯. 问要将这些脆弱的房间都照亮最少须要多少盏灯. 解题思路:题目有…