
POJ
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
【POJ - 2151】Check the difficulty of problems(概率dp)
题干:Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satisfy the following two terms:1. All of th...原创 2019-10-25 20:41:33 · 314 阅读 · 0 评论 -
【POJ - 3744】Scout YYF I(概率dp,矩阵快速幂优化dp)
题干:题目大意:在一条不满地雷的路上(无限长),你现在的起点在1处。在N个点处布有地雷,1<=N<=10。地雷点的可能坐标范围:[1,100000000].每次前进p的概率前进一步,1-p的概率前进2步。问顺利通过这条路的概率。就是不要走到有地雷的地方。设dp[i]表示到达i点且不踩地雷的概率,如果1号点没有地雷,则初始值 dp[1]=1.很容易想到转移方程: dp...原创 2019-10-24 19:52:22 · 254 阅读 · 0 评论 -
**【POJ - 2389】 Bull Math (高精度乘法)
题干: Bulls are so much better at math than the cows. They can multiply huge integers together and get perfectly precise answers ... or so they say. Farmer John wonders if their answers are correct....原创 2018-07-16 23:44:57 · 273 阅读 · 0 评论 -
*【HDU - 1506】【POJ - 2559】Largest Rectangle in a Histogram(单调栈或动态规划)
题干: DescriptionA histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figu...原创 2018-07-16 23:44:49 · 235 阅读 · 0 评论 -
【POJ - 3250 】Bad Hair Day (单调栈)
题干:Some of Farmer John's N cows (1 ≤ N ≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants to count the number of other cows that can see the to...原创 2018-07-16 23:45:53 · 301 阅读 · 0 评论 -
【POJ - 1287】 Networking (并查集 + 最小生成树)
题干:You are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set of possible routes for the cables that may connect pairs...原创 2018-07-16 23:44:24 · 280 阅读 · 0 评论 -
【POJ - 2823】 Sliding Window(单调队列 用双端队列实现或模拟队列)
题干:An array of size n ≤ 10 6 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Eac...原创 2018-07-20 09:14:06 · 384 阅读 · 0 评论 -
**【POJ - 3122】 Pie(二分寻值)
题干:My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and eac...原创 2020-12-20 12:31:04 · 315 阅读 · 0 评论 -
【POJ - 1789】【ZOJ - 2158】【SCU - 1832】Truck History (最小生成树)
题干:DescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing...原创 2018-07-20 00:04:46 · 312 阅读 · 0 评论 -
【POJ - 2349】【UVA - 10369】 Arctic Network(最小生成树求权值第k大的边)(内附两种算法)
题干:The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in establishing the network: ev...原创 2018-07-20 00:10:18 · 389 阅读 · 0 评论 -
【POJ - 3494】Largest Submatrix of All 1’s(加一点思维后化成 单调栈)
题干:Given a m-by-n (0,1)-matrix, of all its submatrices of all 1’s which is the largest? By largest we mean that the submatrix has the most elements.InputThe input contains multiple test cases. E...原创 2018-07-20 00:02:26 · 399 阅读 · 0 评论 -
【POJ - 1703】Find them, Catch them(带权并查集之--种类并查集 权为与父节点关系)
题干: Find them, Catch themTime Limit: 1000MS Memory Limit: 10000K Total Submissions: 36176 Accepted: 11090 DescriptionThe ...原创 2018-07-20 00:11:52 · 464 阅读 · 0 评论 -
*【POJ - 2796】 Feel Good (前缀和优化+单调栈维护)
题干: Feel GoodTime Limit:3000MS Memory Limit:65536K Total Submissions:12409 Accepted:3484 Case Time Limit:1000MS...原创 2019-05-09 21:51:09 · 407 阅读 · 0 评论 -
【POJ - 1182】 食物链(附超详细讲解)(并查集--种类并查集经典题)
题干:动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y",表示X吃Y。 此人对N个动物,用上述两种说法,一句接一句地...原创 2018-07-19 22:38:44 · 2529 阅读 · 0 评论 -
【POJ - 2236】Wireless Network (并查集)
题干:An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in...原创 2018-07-19 23:04:08 · 243 阅读 · 0 评论 -
【POJ - 1751】Highways (最小生成树)
题干:The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem and has already constructed a...原创 2018-07-20 00:02:03 · 622 阅读 · 0 评论 -
*【POJ - 3061】 Subsequence (尺取或二分)
题干:A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal len...原创 2018-07-26 00:50:11 · 227 阅读 · 0 评论 -
【bzoj 1754】【POJ - 2389 】Bull Math (高精度运算)
题干:Bulls are so much better at math than the cows. They can multiply huge integers together and get perfectly precise answers ... or so they say. Farmer John wonders if their answers are correct. He...原创 2018-07-26 01:04:44 · 269 阅读 · 0 评论 -
【POJ - 2376】Cleaning Shifts (贪心)
题干:Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn. He always wants to have one cow working on cleaning things up and has divided the ...原创 2018-07-26 01:18:11 · 272 阅读 · 0 评论 -
【POJ - 1028】 Web Navigation( 栈 or 模拟队列 )
题干:Standard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can ...原创 2018-07-30 22:05:54 · 248 阅读 · 0 评论 -
【POJ - 2387】 Til the Cows Come Home(单源最短路Dijkstra算法)
题干:Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to ...原创 2018-07-30 22:06:11 · 273 阅读 · 0 评论 -
【POJ - 2631 】Roads in the North(树的直径)
题干:Building and maintaining roads among communities in the far North is an expensive business. With this in mind, the roads are build such that there is only one route from a village to a village th...原创 2018-07-30 22:05:11 · 368 阅读 · 0 评论 -
【POJ - 1502】MPI Maelstrom(Dijkstra单源最短路--求一点到其余个点的最小值的最大值)
题干:BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentine McKee's research...原创 2018-07-31 14:33:44 · 419 阅读 · 0 评论 -
【POJ-3259】 Wormholes(判负环,spfa算法)
题干:While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time t...原创 2018-07-31 20:09:12 · 460 阅读 · 0 评论 -
【POJ - 3321】 Apple Tree(dfs序 + 线段树维护 或 dfs序 + 树状数组维护)
题干:There is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the big apple tree.The tree h...原创 2018-08-09 19:03:17 · 320 阅读 · 0 评论 -
【POJ - 3037】Skiing (Dijkstra算法)
题干:Bessie and the rest of Farmer John's cows are taking a trip this winter to go skiing. One day Bessie finds herself at the top left corner of an R (1 <= R <= 100) by C (1 <= C <= 100) ...原创 2018-08-01 22:13:06 · 389 阅读 · 0 评论 -
【POJ - 3268 】Silver Cow Party(Dijkstra最短路+思维)
题干:One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional (one-w...原创 2018-08-01 19:11:05 · 297 阅读 · 0 评论 -
【POJ - 3310】Caterpillar(并查集判树+树的直径求树脊椎(bfs记录路径)+dfs判支链)
题干:An undirected graph is called a caterpillar if it is connected, has no cycles, and there is a path in the graph where every node is either on this path or a neighbor of a node on the path. This p...原创 2018-08-02 15:32:16 · 491 阅读 · 0 评论 -
【POJ - 3468 】 A Simple Problem with Integers (线段树模板 区间更新 + 区间和查询)(不能树状数组或差分数组)
题干:You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for...原创 2018-08-11 11:30:58 · 246 阅读 · 0 评论 -
*【POJ - 1860】Currency Exchange (单源最长路---Bellman_Ford算法判正环)
题干:DescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these cur...原创 2018-08-02 15:33:20 · 608 阅读 · 0 评论 -
【POJ - 1062】【nyoj - 510】昂贵的聘礼 (Dijkstra最短路+思维)
题干:年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者替他弄来其...原创 2018-08-02 21:25:38 · 331 阅读 · 0 评论 -
【POJ - 3169】 Layout(差分约束+spfa)(当板子记?)
题干:Like everyone else, cows like to stand close to their friends when queuing for feed. FJ has N (2 <= N <= 1,000) cows numbered 1..N standing along a straight line waiting for feed. The cows ...原创 2018-08-02 22:44:34 · 262 阅读 · 0 评论 -
【POJ - 3211】Washing Clothes (dp,0-1背包中点问题)
题干:Dearboy was so busy recently that now he has piles of clothes to wash. Luckily, he has a beautiful and hard-working girlfriend to help him. The clothes are in varieties of colors but each piece o...原创 2019-10-18 21:20:06 · 187 阅读 · 0 评论 -
【POJ - 3253】Fence Repair(贪心,时光倒流)
题干:DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer ...原创 2018-10-27 00:55:16 · 442 阅读 · 0 评论 -
【 POJ - 3628 】Bookshelf 2(dfs 或 dp,0-1背包)
题干:Farmer John recently bought another bookshelf for the cow library, but the shelf is getting filled up quite quickly, and now the only available space is at the top.FJ hasNcows (1 ≤N≤ 20) ea...原创 2019-05-09 21:53:34 · 296 阅读 · 0 评论 -
【OpenJ_Bailian - 1258】【POJ - 1258】Agri-Net (最小生成树裸题)
题干:Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course. Farmer John ordered a hig...原创 2018-08-31 13:39:27 · 374 阅读 · 0 评论 -
【POJ - 3624 】Charm Bracelet (dp,0-1背包裸题)
题干:Bessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each charm i in...原创 2018-08-21 14:50:11 · 248 阅读 · 0 评论 -
【POJ - 3259 】Wormholes(Bellman_Ford或spfa算法,判断有向图中是否存在负环)
题干:农夫约翰在探索他的许多农场,发现了一些惊人的虫洞。虫洞是很奇特的,因为它是一个单向通道,可让你进入虫洞的前达到目的地!他的N(1≤N≤500)个农场被编号为1..N,之间有M(1≤M≤2500)条路径,W(1≤W≤200)个虫洞。FJ作为一个狂热的时间旅行的爱好者,他要做到以下几点:开始在一个区域,通过一些路径和虫洞旅行,他要回到最开时出发的那个区域出发前的时间。也许他就能遇到自己了:)...原创 2018-08-28 22:28:32 · 649 阅读 · 0 评论 -
【POJ - 2676】Sudoku (经典深搜,dfs数独)
题干:Sudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 to 9. The...原创 2018-09-01 13:40:15 · 732 阅读 · 0 评论 -
【POJ - 1050】To the Max (dp)
题干:Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a rectangle is the s...原创 2019-10-18 22:06:06 · 164 阅读 · 0 评论