
POJ
wchhlbt
这个作者很懒,什么都没留下…
展开
-
POJ 3617 Best Cow Line
poj;POJ 3617;原创 2016-02-14 18:03:42 · 399 阅读 · 0 评论 -
POJ 2411 Mondriaan's Dream (状压dp)
题目原文:Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on, for原创 2017-02-21 20:21:24 · 351 阅读 · 0 评论 -
POJ 2342 Anniversary party (树形dp)
题目描述: There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation fo原创 2017-02-15 12:47:43 · 295 阅读 · 0 评论 -
POJ 2299 Ultra-QuickSort (树状数组)
解题思路:本题要求求出逆序对的个数,因数据量较大所以采用树状数组的方法。先将所有数据离散化,然后出现一个数字,则在对应的数字位置加一。然后对每个数字统计在他前面有多少个小于等于他的数,也就可以的得到有多少个比他大的数了。AC代码:/* @Author: wchhlbt @Date: 2017/3/1*///#include #include #include原创 2017-03-03 09:48:59 · 283 阅读 · 0 评论 -
POJ 3764 The xor-longest Path (Trie树 + dfs)
题目大意:给一颗有边权的树,求一条路径使得,这条路径上的所有边权异或值最大解题思路:类比数组中求一段区间的和,我们可以用前缀和的思想先预处理出每个节点到根节点的异或前缀和,再有异或的性质可以得到,a^b^b = a,所以有任意两个节点之间的路径的异或和就可以用两个预处理的前缀来表示。公共祖先上面的路径的值会被重复计算两次而抵消。 问题到这里就被简化为了另一个问题,在一组数中,求原创 2017-03-05 10:56:38 · 337 阅读 · 0 评论 -
POJ 2513 Colored Sticks (Trie + 并查集 + 欧拉通路)
题目大意:http://poj.org/problem?id=2513You are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the原创 2017-04-18 20:05:01 · 446 阅读 · 0 评论 -
POJ 1988 Cube Stacking (带权并查集+总结)
解题思路:比较典型的带权并查集,维护每个点到父节点的关系,这里维护的到父节点有几块,当然这道题稍微特殊一点就是还要维护一下每个集合都有几个元素。AC代码:/* @Author: wchhlbt @Date: 2017/4/28*///#include #include #include #include #include #include #includ原创 2017-05-01 12:10:16 · 621 阅读 · 0 评论 -
POJ 1144 Network (割顶)
解题思路:裸的求割顶,细节见代码AC代码:/* @Author: wchhlbt @Date: 2017/5/24*///#include #include #include #include #include #include #include #include #include #include #include #include #in原创 2017-05-24 12:06:38 · 295 阅读 · 0 评论 -
POJ 2187 Beauty Contest (凸包+旋转卡壳)
解题思路:很显然需要求一个凸包,距离最远的点显然凸包上,因为这道题的数据范围比较小,所以可以平方枚举,当然更好的做法是旋转卡壳法。AC代码:/** @Author: wchhlbt* @Last Modified time: 2017-09-07*///#include #include #include #include #include #include #inc原创 2017-09-07 21:52:00 · 341 阅读 · 0 评论 -
POJ 3169 Layout (差分约束)
解题思路:很标准的差分约束题目,根据题意列出不等式,并将所有的不等式转化为 ≤ 形式,然后跑最短路即可。AC代码:/** @Author: wchhlbt* @Last Modified time: 2017-09-19*/#include #include #include #include #include #include #include #include原创 2017-09-19 12:15:52 · 372 阅读 · 0 评论 -
POJ 1364 King (差分约束)
解题思路:如果不能构造出这个数列,那么一定存在两个表达式互相矛盾,例如: s[3] - s[1] >= 3 && s[3]-s[1]在图内表现的效果就是存在环,最长路则存在正环,最短路则存在负环。SPFA求最长路判环即可,注意添加超级源点,把图变成连通图。AC代码:/** @Author: wchhlbt* @Last Modified time: 2017-09-20原创 2017-09-20 18:44:29 · 216 阅读 · 0 评论 -
POJ 1932 XYZZY (差分约束+最长路)
解题思路:按照题目给定条件建图,判断能不能找到一条路到n,在这条路上权值和不会为负数,初始值为100.只需要用spfa跑最长路,遇到正环的时候将当前节点到起点的距离置为 inf 即可。这样可以保证有正环的图一定可以得到解。这道题的代码需要注意一些细节和剪枝。AC代码:/** @Author: wchhlbt* @Last Modified time: 2017-09-20*/原创 2017-09-20 21:07:08 · 342 阅读 · 0 评论 -
hdu 3666 THE MATRIX PROBLEM (差分约束 + 最长路)
解题思路:根据题意可以列出等式 u / xij ≥ ai / bj ≥ l / xij 将这个等式两边取对数,可以转化为差分约束所需要的等式,将 ai bj 建立成为节点,再建立一个超级源点,跑最长路,即满足所有条件的解,找到环则说明无解。因为数据量比较大,所以判环的条件需要减弱一些,我们将节点总数开方进行判断。AC代码:/** @Author: wchhlbt* @L原创 2017-09-21 17:04:50 · 263 阅读 · 0 评论 -
POJ 1141 Brackets Sequence (区间DP + DFS )
解题思路:想要达到最小的长度,关键在于找到合适的位置为不配对的符号配对。如何找到合适的位置呢? 对每一个合适的位置来说,如果从该处将字符串中断,两边所添加的字符总数将会最少。 所以也就是说要求出任意一段字符串所需要添加的字符数量(最小值)还有需要中断的位置。(有点分治的思想)AC代码:#include #defi原创 2017-02-10 19:40:18 · 278 阅读 · 0 评论 -
POJ 1006 Biorhythms (中国剩余定理)
题目大意:找比某一个数大的,对23,28,33三个数模运算得到结果固定的数。解题方法:中国剩余定理的简单应用,因为数据太小也可以考虑直接暴力。关于中国剩余定理,我认为刘汝佳的训练指南上面就讲的非常好了,以后如果有时间我再把这部分补充上来。AC代码:#include #include using namespace std;typedef long long ll;ll exgc原创 2016-10-17 17:10:25 · 332 阅读 · 0 评论 -
POJ 1659 青蛙的邻居
poj 1659原创 2016-02-24 19:04:34 · 971 阅读 · 0 评论 -
POJ 2159 Ancient Cipher(密码变换)
Ancient CipherTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 32679 Accepted: 10629DescriptionAncient Roman empire had a strong government system with var原创 2016-05-22 20:55:51 · 558 阅读 · 0 评论 -
POJ 3258 River Hopscotch (二分法)
传送门:http://poj.org/problem?id=3258River HopscotchTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 10889 Accepted: 4677DescriptionEvery year the cows原创 2016-05-30 20:07:35 · 492 阅读 · 0 评论 -
POJ 1631 Bridging signals(最长上升子序列 nlgn做法)
传送门:http://poj.org/problem?id=1631Bridging signalsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 12687 Accepted: 6915Description'Oh no, they've done原创 2016-05-30 21:41:26 · 482 阅读 · 0 评论 -
POJ 2739 Sum of Consecutive Prime Numbers(线性素数筛+前缀和)
Sum of Consecutive Prime NumbersTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 22735 Accepted: 12432DescriptionSome positive integers can be represented原创 2016-05-22 20:47:45 · 519 阅读 · 0 评论 -
POJ 1979 && HDU 1312 Red and Black(DFS)
DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles原创 2016-03-23 01:04:55 · 306 阅读 · 0 评论 -
POJ 1088 滑雪 (记忆化搜索)
DescriptionMichael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14原创 2016-03-28 16:09:33 · 394 阅读 · 0 评论 -
POJ 2243 Knight Moves(BFS)
Knight MovesTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 13192 Accepted: 7395DescriptionA friend of you is doing research on the Traveling Knight Pro原创 2016-04-29 22:21:46 · 758 阅读 · 0 评论 -
POJ 1061 青蛙的约会 (拓展欧几里得算法)
青蛙的约会Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 106922 Accepted: 21273Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是原创 2016-08-10 19:55:45 · 374 阅读 · 0 评论 -
POJ 1365 Prime Land(质因数分解)
Prime LandTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 3845Accepted: 1728DescriptionEverybody in the Prime Land is using原创 2016-08-10 20:11:53 · 710 阅读 · 0 评论 -
POJ 2356 Find a multiple (抽屉原理)
Find a multipleTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7597Accepted: 3311Special JudgeDescriptionTh原创 2016-08-10 20:36:16 · 355 阅读 · 0 评论 -
POJ Wireless Network (并查集)
Wireless NetworkDescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap原创 2016-09-29 19:52:32 · 410 阅读 · 0 评论 -
POJ 1149 PIGS (最大流建图)
题目原文:DescriptionMirko works on a pig farm that consists of M locked pig-houses and Mirko can't unlock any pighouse because he doesn't have the keys. Customers come to the farm one after anothe原创 2017-09-30 09:32:31 · 240 阅读 · 0 评论