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

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

UVA 1401 – Remember the Word [Trie]


点击打开UVa题目链接 题意 给出一个由S个不同单词组成的字典和一个长字符串。把这个字符串分解成若干个单词的连接(单词可以重复使用),有多少种方法? 分析 先找出递推的公式,然后用字典树查询单词是否出现再字典中。Trie的基础练手题。 C++代码 #include <b...

UVA 1401 – Remember the Word [Trie]

点击打开UVa题目链接 题意 给出一个由S个不同单词组成的字典和一个长字符串。把这个字符串分解成若干个单词的连接(单词可以重复使用),有多少种方法? 分析...
阅读全文 0