HDU 5723 – Abandoned country [Kruskal+DFS]


Link http://acm.hdu.edu.cn/showproblem.php?pid=5723 Problem An abandoned country has n(n≤100000) villages which are numbered from 1 to n. Since abandoned for a long time, the roads need to be re-built. There are m(m≤1000000) roads to be re-built, ...

HDU 5723 – Abandoned country [Kruskal+DFS]

Link http://acm.hdu.edu.cn/showproblem.php?pid=5723 Problem An abandoned country has n(n≤100000) villages which are numbered from 1 to n. Since aba...
阅读全文 0

HDU 1242/ZOJ 1649 – Rescue [最短路]


Link http://acm.hdu.edu.cn/showproblem.php?pid=1242 http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=1649 Problem Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matri...

HDU 1242/ZOJ 1649 – Rescue [最短路]

Link http://acm.hdu.edu.cn/showproblem.php?pid=1242 http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=1649 Problem Angel was caught by the...
阅读全文 0

HDU 1814 – Peaceful Commission [2-SAT]


Link 传送门 Problem The Public Peace Commission should be legislated in Parliament of The Democratic Republic of Byteland according to The Very Important Law. Unfortunately one of the obstacles is the fact that some deputies do not get on with som...

HDU 1814 – Peaceful Commission [2-SAT]

Link 传送门 Problem The Public Peace Commission should be legislated in Parliament of The Democratic Republic of Byteland according to The Very Imp...
阅读全文 0

POJ 1236 – Network of Schools [tarjan-强连通分量]


Link 传送门 Problem A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distributes software (the “receiving schools”). Note that if B is ...

POJ 1236 – Network of Schools [tarjan-强连通分量]

Link 传送门 Problem A number of schools are connected to a computer network. Agreements have been developed among those schools: each school mainta...
阅读全文 0

HDU 3768 – Shopping [最短路+全排列枚举]


Link 传送门 Problem You have just moved into a new apartment and have a long list of items you need to buy. Unfortunately, to buy this many items requires going to many different stores. You would like to minimize the amount of driving necessary t...

HDU 3768 – Shopping [最短路+全排列枚举]

Link 传送门 Problem You have just moved into a new apartment and have a long list of items you need to buy. Unfortunately, to buy this many items r...
阅读全文 0

POJ 3678 – Katu Puzzle [2-SAT入门题]


Link 传送门 Problem Katu Puzzle is presented as a directed graph G(V, E) with each edge e(a, b) labeled by a boolean operator op (one of AND, OR, XOR) and an integer c (0 ≤ c ≤ 1). One Katu is solvable if one can find each vertex Vi a value Xi (0 ...

POJ 3678 – Katu Puzzle [2-SAT入门题]

Link 传送门 Problem Katu Puzzle is presented as a directed graph G(V, E) with each edge e(a, b) labeled by a boolean operator op (one of AND, OR, X...
阅读全文 0

UVa 11748 – Rigging Elections [求可达矩阵]


Link 传送门 Problem Elections in your country are performed in a one-on-one elimination style. Each week, two people are chosen from a pool of candidates and the country votes on which one they prefer. The loser is eliminated and the winner is ret...

UVa 11748 – Rigging Elections [求可达矩阵]

Link 传送门 Problem Elections in your country are performed in a one-on-one elimination style. Each week, two people are chosen from a pool of cand...
阅读全文 2

UVa 1423 – Guess [数列前缀和+拓扑排序]


Problem 传送门 Mean 给你一个数n和一个字符矩阵,矩阵中S(i, j)表示ai + a(i+1) +…aj的正负号,要你还原a序列,其中a序列中每个数的绝对值不大于10.数列最多10个数 Analysis 根据每个数列段的符号可以转化为两个前缀和的大小关系,这就就得到了拓扑关系,拓扑...

UVa 1423 – Guess [数列前缀和+拓扑排序]

Problem 传送门 Mean 给你一个数n和一个字符矩阵,矩阵中S(i, j)表示ai + a(i+1) +…aj的正负号,要你还原a序列,其中a序列中每个数的绝对值不大于10.数...
阅读全文 0

UVa 1424 – Salesmen [DP]


Link 传送门 Mean 给定一个N个点M条边的无向图,一个人走出了一个路径,但这个路径有可能是不对的,例如图上并没有某条边。给你这个路径,让你再找出一条等长的路径,使得两条路径的距离最近。 路径的距离定义如下:每个点相同为0,不同为1. Analysis 比较简单的dp,...

UVa 1424 – Salesmen [DP]

Link 传送门 Mean 给定一个N个点M条边的无向图,一个人走出了一个路径,但这个路径有可能是不对的,例如图上并没有某条边。给你这个路径,让你再找出一条等长...
阅读全文 0

CodeForces 601A – The Two Routes [最短路坑题]


Link 点击打开题目链接 Problem In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between to...

CodeForces 601A – The Two Routes [最短路坑题]

Link 点击打开题目链接 Problem In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simp...
阅读全文 0