HDU 4770 Lights Against DudelyLights】的更多相关文章

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…
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…
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, Harry! Gringotts, the wizard bank! Ain't no safer place. Not one. Except perhaps Hogwarts." ― Rubeus Hagrid…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4770 思路:由于最多只有15个".",可以直接枚举放置的位置,然后判断是否能够全部点亮即可.需要注意的是,有一个特殊的light,也需要枚举它的位置以及放置的方向. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using names…
状压+暴力搜索 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…
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=5820 [题目大意] 在一个大小为50000*50000的矩形中,有n个路灯. 询问是否每一对路灯之间存在一条道路,使得长度为|x1–x2|+|y1–y2|且每个拐弯点都是路灯. [题解] 只要找到不共线的两个点,他们所构成的矩阵剩余的两个点都是不存在的,那么这个图就是违法的.那么如何找呢,我们将所有点按照x为第一关键字,y为第二关键字排序,逐行扫描,对于每个点,扫描与他同行的前后两个点的列坐标形…