07 2012 档案
摘要:zju 1654 Place the Robots//zju 1654 Place the Robots//题意://给出一个地图,有空地,草地,墙壁。//要在空地上放能像4个方向发射激光的机器人,//问最多能放多少个,机器人不能对打//思路://分别对横向和纵向分块。分块方法:对从空地开始//相连...
阅读全文
摘要:最短路 hdu 3499 Flight//最短路 hdu 3499 Flight//最短路//题意:给出n个地点,m条有向带权边,给出起点和终点,可以把//其中一条边的权值减少一半,求起点到终点的最短路//思路:分别求起点到各个点的最短路 和 终点到各个点的最短路(要用反向边)//当然,把最短路存放...
阅读全文
摘要:hdu 1811 Rank of Tetris//hdu 1811 Rank of Tetris//并查集+拓扑//思路:用并查集把相等的点归到一起,再用拓扑//纠结这题纠结了一整天,看了n多的博客感觉这个不错//http://972169909-qq-com.iteye.com/blog/1052820#include <stdio.h>#include <string.h>#include <queue>using namespace std;#define comein freopen("in.txt", "r"
阅读全文
摘要:RMQ hdu 3183 A Magic Lamp//hdu 3183 A Magic Lamp//RMQ//用RMQ求剩下的n-m个数,第一个数肯定在第一个数和第m+1 个数之间的最小的那个数,//包括第一和m+1,第二个数肯定在上一次求的数到第m+2 个数之间,依次类推//注意:预处理log时,...
阅读全文
摘要:福建农林大学 FAFU poj也有一题和这题差不多的,可以去尝试看看http://acm.fafu.edu.cn/problem.php?id=1272RMQ poj 3264 Balanced Lineup//poj 3264 Balanced Lineup//RMQ//用RMQ求出最大值和最小值...
阅读全文
摘要:hdu 1044 Collect More Jewels 搜索//hdu 1044 Collect More Jewels//搜索//题意:起点 '@' 终点 '#include #define N 55#define INF 1= 0 && x = 0 && y limit) re...
阅读全文
摘要:hdu 2485 Destroying the bus stations 搜索(迭代加深)//hdu 2485 Destroying the bus stations//搜索(迭代加深)//没有反向边#include #include #define N 55#define INF 1= limit...
阅读全文
摘要:hdu 1026 Ignatius and the Princess I//hdu 1026 Ignatius and the Princess I//广搜#include #include #include using namespace std;#define N 105#define INF ...
阅读全文
摘要:http://acm.fafu.edu.cn/problem.php?id=1266 fafu oj 1266 数数 //fafu oj 1266 数数 //二分,具体看代码 #include <stdio.h> #include <string.h> #include <algorithm> us
阅读全文
摘要:http://acm.fafu.edu.cn/problem.php?id=1048fafu oj 1048 一个简单的问题 //fafu oj 1048 一个简单的问题 //二分#include #include #include using namespace std;const int N ...
阅读全文
摘要:hdu 4193 Non-negative Partial Sums//hdu 4193 Non-negative Partial Sums//单调队列//看了这个解题报告才有所理解的http://blog.ac521.org/?p=123//题意:给定一个长n的循环队列(n<=1000000),可以循环形成序列(共n种),//对于每种序列求前i项和sum(i),求形成的循环序列有多少种 满足//任意的sum(i)>=0;(0<i<=N)。//思路: 首先用循环序列的一般处理方法,两个接在一起,//然后处理出来sum,使用单调队列,滚动求长n的子序列的最小值。//如果最
阅读全文
摘要:hdu 3415 Max Sum of Max-K-sub-sequence//hdu 3415 Max Sum of Max-K-sub-sequence//单调队列//题意是说给出一串数字,形成环,求长度小于等于k的子串中的最大子串和//思路:用数组num[i]保存前i个数的和,由于 1<=K<=N,所欲数组继续延伸到2n个元素//就可以忽视环。让后维护一个单调队列,使之保存 i-k到 i-1之间最小 子串和,//从而,num[i] - que[head] 就是 i-k 到 i 之间的最大子串和#include <stdio.h>#include <strin
阅读全文
摘要:poj 3026 Borg Maze//poj 3026 Borg Maze//bfs+MST(广搜+最小生成树)//这题的英文实在看不懂,百度了别人的解题报告才知道意思的,所以要多多使用英语来慢慢提高才行//这题的意思是要通过'S'去找'A',找到一个'A'就把它同化掉帮忙去同化别的'A'//其实...
阅读全文
摘要:poj 1258 Agri-Net//poj 1258 Agri-Net//最小生成树(MST)#include #include #define N 105#define INF 1 dis[i]) { min = dis[i]; ...
阅读全文
摘要:poj 2485 Highways//poj 2485 Highways//MST(minimum spanning tree)//here is want to get the longest road#include #include #define N 505#define INF 1 dis...
阅读全文
摘要:poj 1789 Truck History//poj 1789 Truck History//MST(minimum spanning tree)//It's mean is: there is several type of truck and every truck//is marked by...
阅读全文
摘要:poj 1094 Sorting It All Out 拓扑排序//poj 1094 Sorting It All Out 拓扑排序//这题要先判断是否有环的存在(可以用floyd算法看有没有能到自己的结点来判断,//也可以把度数为0的点一个一个排除,直到没有结点为止,若还有结点没排除,且//没有...
阅读全文

浙公网安备 33010602011771号