![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
online judge POJ
Yishui_Blog
Try our best
展开
-
HDU - 3836 Equivalent Sets ( 加边使其为强连通图
题目描述To prove two sets A and B are equivalent, we can first prove A is a subset of B, and then prove B is a subset of A, so finally we got that these two sets are equivalent. You are to prove ...原创 2018-06-07 20:38:54 · 227 阅读 · 0 评论 -
POJ 2777 Count Color ( 线段树&&位运算
Count ColorDescriptionChosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem. There is a very long board with lengt原创 2017-09-21 17:14:25 · 527 阅读 · 0 评论 -
Poj 1789 Truck History (最小生成树K
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 desc原创 2017-08-03 20:00:40 · 353 阅读 · 0 评论 -
Poj 1985 Cow Marathon ( 树的直径
Cow MarathonDescriptionAfter hearing about the epidemic of obesity in the USA, Farmer John wants his cows to get more exercise, so he has committed to create a bovine marathon for his cows to run. The原创 2017-07-24 00:38:43 · 605 阅读 · 0 评论 -
Poj1383 - Labyrinth (搜索
DescriptionThe northern part of the Pyramid contains a very large and complicated labyrinth. The labyrinth is divided into square blocks, each of them either filled by rock, or free. There is also a li原创 2017-07-24 00:28:20 · 343 阅读 · 0 评论 -
POJ - 1258 Agri-Net ( prime
DescriptionFarmer 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原创 2017-08-08 00:26:09 · 394 阅读 · 0 评论 -
Poj 1847 Tram ( 最短路变形
TramDescriptionTram network in Zagreb consists of a number of intersections and rails connecting some of them. In every intersection there is a switch pointing to the one of the rails going out of the原创 2017-08-08 00:07:48 · 249 阅读 · 0 评论 -
Poj 1860 Currency Exchange ( SPFA
Currency Exchange 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原创 2017-08-07 23:59:25 · 266 阅读 · 0 评论 -
Poj 3628 Silver Cow Party ( 最短路变形
Silver Cow Party DescriptionOne 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)原创 2017-08-07 23:56:09 · 255 阅读 · 0 评论 -
Poj 1797 Heavy Transportation ( 最短路变形
Heavy Transportation DescriptionBackground Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really原创 2017-08-07 23:52:25 · 303 阅读 · 0 评论 -
求 LCA的几种算法的实现方法模板( 例题POJ1330
哎 感博客还是要写的 要不每天都在偷懒QAQ 真的会变渣的啊Tarjan算法的实现模板#include <cstdio>#include <vector>#include <algorithm>using namespace std;const int MAXN = 1e5+10;int f[MAXN], ances[MAXN];int in[MAXN], vis[MAXN];vecto原创 2017-12-15 01:25:24 · 335 阅读 · 0 评论 -
Poj 3259 Wormholes ( SPFA&&bellman-ford
Wormholes DescriptionWhile 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 des...原创 2017-08-08 00:02:22 · 241 阅读 · 0 评论 -
POJ 1511 Invitation Cards (堆优化Dij/SPFA
题目描述In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies....原创 2018-02-14 00:23:09 · 271 阅读 · 0 评论 -
POJ - 1651 Multiplication Puzzle ( 区间dp
⼀组数字,第⼀个和最后⼀个数字不可以取出去,其它任意取出去,当你要取出⼀个数字时,它有⼀个代价,这个代价就是与它相邻的两个数的乘积,求除了⾸位两位数字,把其他数字都取出来,它们的代价之和的最小值 明显的区间dp问题,注意最大枚举的段最小是三个就行了#pragma comment(linker, "/STACK:1024000000,1024000000")#include <cstd...原创 2018-06-21 21:04:24 · 179 阅读 · 0 评论 -
POJ - 2955 Brackets ( 区间dp
http://poj.org/problem?id=2955 数组开的大了就一直TLE, 不知道为什么,,,状态定义为 dp[i][j]编号i到编号j的括号的最大匹配数目dp[i][j]编号i到编号j的括号的最大匹配数目dp[i][j] 编号i到编号j的括号的最大匹配数目 区间dp 每次枚举i-j之间的最大匹配数目 状态转移方程为 dp[i][j]=max(dp[i][k]+dp[k+...原创 2018-06-21 10:37:48 · 169 阅读 · 0 评论 -
POJ 3461 Oulipo ( KMP板子
KMP的模板题 问模式串在文本串中出现了几次,我这里求的next是定字符串的最长前缀和最长后缀相同的长度,还有一种速度应该是比这个快的求法 #pragma comment(linker, "/STACK:1024000000,1024000000")#include <cstdio>#include <iostream>#include <cstdlib...原创 2018-06-11 21:08:36 · 143 阅读 · 0 评论 -
POJ 2247 Maximum sum ( dp
Maximum sum题目描述Given a set of n integers: A={a1, a2,…, an}, we define a function d(A) as below:Your task is to calculate d(A).输入The input consists of T(<=30) test cases. The number of t...原创 2018-04-26 16:17:57 · 100 阅读 · 0 评论 -
POJ 3321 Apple Tree ( DFS+BIT
Apple Tree 题目描述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 tr...原创 2018-04-07 21:35:34 · 106 阅读 · 0 评论 -
POJ 2299 Ultra-QuickSort (BIT / 归并排序
Ultra-QuickSort 题目描述In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until...原创 2018-03-20 17:51:31 · 143 阅读 · 0 评论 -
POJ 3984 迷宫问题 ( BFS
迷宫问题 题目描述定义一个二维数组: int maze[5][5] = {0, 1, 0, 0, 0,0, 1, 0, 1, 0,0, 0, 0, 0, 0,0, 1, 1, 1, 0,0, 0, 0, 1, 0,}; 它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。输入一...原创 2018-03-20 17:46:21 · 261 阅读 · 0 评论 -
POJ 3784 Running Median( 堆优化
Running Median 题目描述For this problem, you will write a program that reads in a sequence of 32-bit signed integers. After each odd-indexed value is read, output the median (middle value) of the elem...原创 2018-03-10 20:50:39 · 283 阅读 · 0 评论 -
POJ 3255 Roadblocks (次短路
题目描述Bessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly, because she likes the scenery along the wa...原创 2018-02-14 16:33:13 · 198 阅读 · 0 评论 -
POJ 2253 Frogger (最短路
FroggerDescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full原创 2017-08-07 23:47:37 · 283 阅读 · 0 评论 -
Poj 1502 MPI Maelstrom (Dijkstra
MPI MaelstromDescriptionBIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentin原创 2017-08-07 23:40:12 · 265 阅读 · 0 评论 -
Poj 1182 食物链 (并查集
食物链Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 67954Accepted: 20088Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构原创 2017-02-23 14:17:27 · 344 阅读 · 0 评论 -
Poj1852Ants
AntsTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 15943 Accepted: 6868DescriptionAn army of ants walk on a horizontal pole of length l cm, each with a c原创 2016-12-15 20:21:30 · 228 阅读 · 0 评论 -
Poj 2031 Building a Space Station ( 最小生成树Krustra
Building a Space StationTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 8435Accepted: 4029DescriptionYou are a member of the space station engineering team, and are assigned a task in the cons原创 2017-03-22 22:30:42 · 421 阅读 · 0 评论 -
Poj 1915 Knight Moves ( BFS
Knight MovesTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 25761Accepted: 12178DescriptionBackground Mr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knig原创 2017-03-22 08:32:32 · 402 阅读 · 0 评论 -
POJ 2236 Wireless Network (并查集
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 co原创 2017-02-22 20:03:52 · 210 阅读 · 0 评论 -
Poj 2524 Ubiquitous Religions (并查集
Ubiquitous ReligionsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 33073 Accepted: 16024DescriptionThere are so many different religions in the world tod原创 2017-01-23 00:38:08 · 248 阅读 · 0 评论 -
Poj 3096 Saruman's Army (贪心
Saruman's ArmyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8970 Accepted: 4511DescriptionSaruman the White must lead his army along a straight path原创 2017-01-22 21:00:59 · 212 阅读 · 0 评论 -
Poj1995Raising Modulo Numbers(快速幂)
Raising Modulo NumbersTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 7176 Accepted: 4323DescriptionPeople are different. Some secretly read magazines ful原创 2016-12-18 23:53:51 · 300 阅读 · 0 评论 -
Poj 1321 棋盘问题 ( DFS
棋盘问题Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 40249Accepted: 19640Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有原创 2017-02-05 23:58:34 · 261 阅读 · 0 评论 -
POJ 1363 Rails ( 栈
RailsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 32888Accepted: 12842DescriptionThere is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built原创 2017-01-29 23:32:45 · 1260 阅读 · 0 评论 -
POJ 2431 Expedition (优先队列
ExpeditionTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 13904Accepted: 3940DescriptionA group of cows grabbed a truck and ventured on an expedition deep into the jungle. Being rather poor d原创 2017-01-26 00:09:42 · 642 阅读 · 0 评论 -
Poj 1979 Red and Black(DFS)
Red and BlackTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 32802 Accepted: 17834DescriptionThere is a rectangular room, covered with square tiles. Each原创 2017-01-05 17:33:35 · 431 阅读 · 0 评论 -
Poj 3264 Balanced Lineup ( 线段树
Balanced LineupDescriptionFor the daily milking, Farmer John’s N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of原创 2017-07-31 20:32:29 · 297 阅读 · 0 评论 -
Poj- 1384-Piggy-Bank (完全背包
Piggy-Bank DescriptionBefore ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The原创 2017-06-10 17:20:35 · 329 阅读 · 0 评论 -
Poj-3253-Fence Repair ( 哈夫曼
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 int原创 2017-06-10 00:34:12 · 261 阅读 · 0 评论 -
Poj - 3070 Fibonacci (矩阵快速幂
Fibonacci DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2, 3, 5, 8, 13, 21, 3原创 2017-05-31 14:31:20 · 351 阅读 · 0 评论