
POJ
文章平均质量分 85
EIKY
这个作者很懒,什么都没留下…
展开
-
POJ-1113-Wall(凸包)
链接:http://poj.org/problem?id=1113大致题意:N个点围成的城堡,求距离城堡大于L处建围墙,求围墙的最短距离凸包问题,考虑到对于一个凸包上的一个x度的角,其需要一个180-x度半径为L的圆弧形状围墙,即求凸包周长+以L为半径圆的周长。//FS//#pragma comment(linker, "/stack:1024000000,1024000000") //#i...原创 2018-03-15 23:13:27 · 446 阅读 · 0 评论 -
POJ-2115-C Looooops(扩展欧几里得)
DescriptionA Compiler Mystery: We are given a C-language style for loop of typefor (variable = A; variable != B; variable += C) statement;I.e., a loop which starts by setting variable to原创 2016-03-09 20:20:42 · 315 阅读 · 0 评论 -
POJ-2689-Prime Distance(筛法)
Language:DefaultPrime DistanceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 15777 Accepted: 4194DescriptionThe branch of mathematics called numb原创 2016-05-06 11:16:35 · 3540 阅读 · 0 评论 -
POJ-1201-Intervals(差分约束)
Language:DefaultIntervalsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 24357 Accepted: 9264DescriptionYou are given n closed, integer intervals原创 2016-05-04 13:32:48 · 535 阅读 · 0 评论 -
POJ-3216-Repairing Company(最小路径覆盖)
Language:DefaultRepairing CompanyTime Limit: 1000MS Memory Limit: 131072KTotal Submissions: 6925 Accepted: 1861DescriptionLily runs a repair原创 2016-05-03 20:27:00 · 435 阅读 · 0 评论 -
POJ-1094-Sorting It All Out(拓扑排序)
Language:DefaultSorting It All OutTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 32037 Accepted: 11131DescriptionAn ascending sorted sequence of原创 2016-05-13 21:17:16 · 446 阅读 · 0 评论 -
POJ-1904-King's Quest(强连通分量)
大致题意:N个王子,N个妹子,每个王子喜欢N个妹子中的K个,现给出一组完美匹配,题意扯了半天其实就是让求所有完美匹配每个王子解的集合。题解:很好,要不是丢强连通分类里就当匹配来做了。。。问题主要在建边,设王子集合为X,妹纸集合为Y,那么王子的选择为X->Y,已知一组完美匹配方案X'->Y',那么我们建反边Y'->X'(其实还是用到了二分匹配寻找增广路的思想),模拟匈原创 2016-05-13 19:40:48 · 356 阅读 · 0 评论 -
POJ-1548-Robots(最小路径覆盖)
Language:DefaultRobotsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 4160 Accepted: 1912DescriptionYour company provides robots that can be used原创 2016-05-02 17:00:19 · 317 阅读 · 0 评论 -
POJ-2594-Treasure Exploration(可重点最小路径覆盖)
Language:DefaultTreasure ExplorationTime Limit: 6000MS Memory Limit: 65536KTotal Submissions: 7715 Accepted: 3177DescriptionHave you ever read any book abou原创 2016-05-01 21:11:55 · 345 阅读 · 0 评论 -
POJ-3164-Command Network(最小树形图)
Command NetworkTime Limit: 1000MS Memory Limit: 131072KTotal Submissions: 15889 Accepted: 4571DescriptionAfter a long lasting war on words, a war on arms fina原创 2016-05-01 10:48:15 · 326 阅读 · 0 评论 -
HDU-1496-Equations && POJ-1840-Eqs (hash)
HDU1494:a*x1^2+b*x2^2+c*x3^2+d*x4^2=0分块HASH:O(N^4)->O(N^2+N^2)POJ1840:a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0 分块HASH:O(N^5)->O(N^2+N^3)HDU 1496://#include #include #include #inclu原创 2016-05-12 12:14:56 · 378 阅读 · 0 评论 -
POJ-1471-Tree(点分治)
题目链接:http://poj.org/problem?id=1741大致题意:给定一棵N(1vu,两点间的最短路径长度,路径的长度定义为路径上所有边的权和。再给定一个K(1足dist(a,b)求合法点对个数。 大致题解:(参考国家集训队论文:http://wenku.baidu.com/link?url=7KOPn20aLvKK5PqDmuLjIyj4sqZ6CL原创 2016-05-11 20:48:07 · 797 阅读 · 0 评论 -
HDU-1200-Crazy Search(hash)
题目链接:http://poj.org/problem?id=1200题意:N是子串的长度,NC是原串中所含的不同字母的个数,求的是text中长度为N的不相同的子串有多少个。题解:hash水题,直接hash成NC进制就好。//#include #include #include #include #include #include #define INF 0原创 2016-05-12 10:35:07 · 300 阅读 · 0 评论 -
POJ-1679-The Unique MST(次小生成树)
Language:DefaultThe Unique MSTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 26364 Accepted: 9419DescriptionGiven a connected undirected graph, t原创 2016-04-29 18:47:03 · 392 阅读 · 0 评论 -
POJ-2195-Going Home(最小费用最大流/二分图)
Going HomeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 20717 Accepted: 10502DescriptionOn a grid map there are n little men and n houses. In each u原创 2016-04-09 14:47:59 · 242 阅读 · 0 评论 -
POJ-2975-Nim(Nim博弈)
链接:http://poj.org/problem?id=2975Language:DefaultNimTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5379 Accepted: 2520DescriptionNi原创 2016-05-18 19:34:20 · 410 阅读 · 0 评论 -
POJ-2960-S-Nim(SG函数)
题目链接:http://poj.org/problem?id=2960Language:DefaultS-NimTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 3880 Accepted: 2034Description原创 2016-05-19 20:04:30 · 347 阅读 · 0 评论 -
POJ-3415-Common Substrings(后缀数组+单调栈)
链接:http://poj.org/problem?id=3415求两串中长度大于k的公共子串有多少个。公共子串可以通过height求,中间分隔连接两串,将height[i]>=k进行分组,对于一组内的height[i],且sa[i]属于a串,需要找到ji]-k),采用单调栈维护一个栈顶最小的height[i],大于栈顶压入,小于更新。每次针对a/b串找前面的b/a串,跑两原创 2017-05-04 16:16:58 · 606 阅读 · 0 评论 -
POJ-3694-Network(Tarjan+LCA+并查集)
链接:http://poj.org/problem?id=3694给出无向图,动态加边,求每次加边后图中桥的个数。缩点求并查集,然后按照DFS序找LCA维护桥的个数。//#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #incl原创 2017-04-22 13:52:51 · 708 阅读 · 0 评论 -
POJ-3686-The Windy's(KM/费用流)
链接:http://poj.org/problem?id=3686N个订单M个车间,N*M的矩阵给出第i个订单在第j个车间生产所需时间,车间有任务则需等待,求完成所有订单所需的平均时间;对于同一个车间的k个订单,有工作时间t=T1+(T1+T2)+(T1+T2+T3)+...+(T1+T2+...+Tk),则平均工作时间tav=t/k;有t=T1*k+T2*(k-1)+...Tk ,原创 2017-04-21 20:54:46 · 492 阅读 · 0 评论 -
POJ-2400-Supervisor, Supervisee(KM+DFS)
链接:http://poj.org/problem?id=2400有n个老板和n个员工,他们彼此有一个好感排名,现在要求选出最好的对应关系使他们平均分值最少输出所有最小权匹配,DFS最小匹配找所有匹配,注意剪枝。//#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include原创 2017-04-21 19:40:17 · 560 阅读 · 0 评论 -
POj-3101-Astronomy(分数GCD+BigInteger)
链接:http://poj.org/problem?id=3101题意:给出每颗行星的运行周期,问多久运行到一条直线上角速度为v = 2*π/T以第一颗行星为参照点则其他行星的相对速度为V' = (Ti- T0)*2π/(Ti*T0)半个周期即可在同一条直线上绕过半个圆周的时间为t = π/V' = (T0*Ti)/((T0 - Ti)*2) n原创 2017-05-03 21:29:53 · 662 阅读 · 0 评论 -
POJ-2154-Color(Pólya)
链接:http://poj.org/problem?id=2154//#include #pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #include #include #include #include using namespa原创 2017-05-03 20:21:38 · 475 阅读 · 0 评论 -
POJ-3683-Priest John's Busiest Day(2-SAT染色)
链接:http://poj.org/problem?id=36832-SAT求其中一个解,详见2-SAT解法浅析//#include #pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #include #include #include原创 2017-05-02 21:18:42 · 845 阅读 · 0 评论 -
POJ-3155-Hard Life(最大密度子图)(01分数规划+最小割)
链接:http://poj.org/problem?id=3155求最大密度子图,见论文:算法合集之《最小割模型在信息学竞赛中的应用》P20-26//#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #include #in原创 2017-04-19 21:17:28 · 398 阅读 · 0 评论 -
POJ-3436-ACM Computer Factory(网络流)
链接:http://poj.org/problem?id=3436拆点求最大流,并求出每边的流量。#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #include #include #include #include using n原创 2017-04-02 12:30:27 · 338 阅读 · 0 评论 -
POJ-3026-Borg Maze(Prim+BFS)
链接:http://poj.org/problem?id=3026水题,注意数组大小,测试数据有点坑。#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #include #include #include #include u原创 2017-03-31 12:39:11 · 230 阅读 · 0 评论 -
POJ-3083-Children of the Candy Corn(DFS+BFS)
链接:http://poj.org/problem?id=3083求沿左墙走到目标点的距离,和沿右墙走到目标点的距离,以及到目标点的最短距离;求两个沿边走的路径DFS,按照上一个点的位置分别顺时针和逆时针优先遍历就好了。#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include原创 2017-03-30 19:29:51 · 243 阅读 · 0 评论 -
POJ-2049-Finding Nemo(BFS)
链接:http://poj.org/problem?id=2049将坐标系转为格子图,两点之间可能有墙,或者门,也可能什么都没有,没有的花费为0,门的花费为1,问到目标点的最少花费是多少注意题目中的输入范围,四位二进制表示下点四周的边墙情况,然后bfs更新下各点最优值。#pragma comment(linker, "/STACK:1024000000,102400原创 2017-03-29 20:44:11 · 269 阅读 · 0 评论 -
POJ-1062-昂贵的聘礼(SPFA)
链接:http://poj.org/problem?id=1062具有点权限制的最短路,在松弛度内枚举区间限制跑最短路就好。#include #include #include #include #include #include using namespace std;#define INF 0x3f3f3f3f#define MAXN 510#define M原创 2017-03-28 16:57:55 · 407 阅读 · 0 评论 -
HDU-4685-Prince and Princess(二分匹配+强连通分量)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4685POJ1904加强版本大致题意:N个王子,N个妹子,每个王子喜欢N个妹子中的K个,让求所有最大匹配每个王子解的集合。题解:问题主要在建边,设王子集合为X,妹纸集合为Y,那么王子的选择为X->Y,已知一组完美匹配方案X'->Y'原创 2016-05-20 21:50:28 · 439 阅读 · 0 评论 -
POJ-1149-PIGS(最大流)
InputThe first line of input contains two integers M and N, 1 The next line contains M integeres, for each pig-house initial number of pigs. The number of pigs in each pig-house is greater or eq原创 2016-04-08 13:08:36 · 280 阅读 · 0 评论 -
POJ-1273-Drainage Ditches(最大流)dinic实现 后续模板待补充
Sample Input5 41 2 401 4 202 4 202 3 303 4 10Sample Output50#include #include #include #include #include #include #include #include #include #include #include #include us原创 2016-04-06 20:38:58 · 323 阅读 · 0 评论 -
POJ-1743-Musical Theme(后缀数组+二分)
Sample Input3025 27 30 34 39 45 52 60 69 79 69 60 52 45 39 34 30 26 22 1882 78 74 70 66 67 64 60 65 800Sample Output5大致题意:求不可重叠最长重复子串 参考 国家集训队论文:算法合集之《后缀数组——处理字符串的有力工具》 先二分答案,原创 2016-04-05 21:33:33 · 304 阅读 · 0 评论 -
POJ---2003-Hire and Fire
Hire and FireTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2342 Accepted: 667DescriptionIn this problem, you are asked to keep track of the hierarch原创 2015-08-19 13:52:24 · 558 阅读 · 0 评论 -
POJ---1330-Nearest Common Ancestors
Nearest Common AncestorsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 21976 Accepted: 11499DescriptionA rooted tree is a well-known data structure i原创 2015-08-19 11:30:03 · 318 阅读 · 0 评论 -
POJ---2299-Ultra-QuickSort
Ultra-QuickSortTime Limit: 7000MS Memory Limit: 65536KTotal Submissions: 48797 Accepted: 17839DescriptionIn this problem, you have to analyze a particular sorting原创 2015-08-18 15:09:52 · 383 阅读 · 0 评论 -
POJ---2503-Babelfish
BabelfishTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 36929 Accepted: 15737DescriptionYou have just moved from Waterloo to a big city. The people her原创 2015-08-18 13:31:24 · 353 阅读 · 0 评论 -
POJ---1363-Rails(stack)
RailsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 28247 Accepted: 10970DescriptionThere is a famous railway station in PopPush City. Country there is i原创 2015-08-16 13:02:43 · 354 阅读 · 0 评论 -
POJ---2106-Boolean Expressions(stack)
Boolean ExpressionsTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 3662 Accepted: 1101DescriptionThe objective of the program you are going to produce i原创 2015-08-16 15:18:35 · 517 阅读 · 0 评论