上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 52 下一页
摘要: 和poj 3352 一样, 相同的代码都能过。#include <stdio.h>#include <string.h>#include <iostream>using namespace std;#define N 5050#define M 10010#define INF 0x3fffffffstruct node{ int from,to,next;}edge[2*M];int n,m;int cnt,pre[N];bool mark[2*M];bool save[2*M];int low[N];int link[N];int d[N];void a 阅读全文
posted @ 2013-05-20 17:41 chenhuan001 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 先求出桥,然后去除桥后得到边双联通分量, 将边联通分量缩成一个点, 然后就出所有度为1的点(叶子节点)个数n,答案就是n/2+n%2.#include <stdio.h>#include <string.h>#include <iostream>using namespace std;#define N 5050#define M 10010#define INF 0x3fffffffstruct node{ int from,to,next;}edge[2*M];int n,m;int cnt,pre[N];bool mark[2*M];bool save 阅读全文
posted @ 2013-05-20 17:26 chenhuan001 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 以前看过KMP, 但是今天没有看资料, 自己想的,完全想通,感叹KMP的奇妙。Number SequenceTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7750Accepted Submission(s): 3532Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 & 阅读全文
posted @ 2013-05-19 02:19 chenhuan001 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 比较简单LCA的题目了, 主要就是根据题目所给出的树边建立有向的树, 然后从树根开始进行LCA, 要注意的是,题目中给的操作有两种,第一种是从当前点到父亲结点,第二种是从当前点到子树中的任意一个点。CD操作Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 102Accepted Submission(s): 24Problem Description 在Windows下我们可以通过cmd运行DOS的部分功能,其中CD是一条很有意思的命令,通过. 阅读全文
posted @ 2013-05-17 21:54 chenhuan001 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 先求出点的双联通分量,每个分量可以看成一系列相邻的环, 且只要在一个联通分量发现奇数环那么这个分量的所有点都在奇环中.Knights of the Round TableTime Limit:7000MSMemory Limit:65536KTotal Submissions:7598Accepted:2358DescriptionBeing a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress, and drinking with the other kni 阅读全文
posted @ 2013-05-17 18:51 chenhuan001 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 寻找割边又叫桥。 和找割点的很类似Burning BridgesTime Limit:5 Seconds Memory Limit:32768 KBFerry Kingdom is a nice little country located on N islands that are connected by M bridges. All bridges are very beautiful and are loved by everyone in the kingdom. Of course, the system of bridges is designed in such a way t 阅读全文
posted @ 2013-05-15 13:46 chenhuan001 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 挺有意思的题。思路不难, 用hash判重, 但是要坑人的是一开始怎么将每串序列按照同一规律排列。比如2 1 2 1 1 2 1 1 2 2 1 2怎么转化为 1 1 2 2 1 2 ,也就是转化为字典序最小, 最后没有办法只有枚举, 3000+ms 险过.Snowflake Snow SnowflakesTime Limit:4000MSMemory Limit:65536KTotal Submissions:26254Accepted:6900DescriptionYou may have heard that no two snowflakes are alike. Your task i 阅读全文
posted @ 2013-05-15 00:05 chenhuan001 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 其实就是以dfs的顺序进行背包处理. 想了快一天,终于1A了, 但是虽然过了,但是心里还是有点虚,可能对背包的原理没有透彻掌握,所以宏观上看是可行的,但是一想到一步一步的具体转移时又会觉得很混乱. 一、首先这种题要做的是确定状态, 每个结点要记录什么状态 ? 这题根据题意要记录的是 1. 从这个结点u开始不到达u以上的结点但是最后回到u结点经过的最大权 记为dp[u][k] 2.从这个结点u开始不到达u以上的结点最后不必回到u经过的最大权 记为dp1[u][k]二、有了这两个条件就可以进行状态转移了。 假设当前结点为u, u的子结点为 vi那么从u结点出发最后回到u结点的所有情况为 dp1[. 阅读全文
posted @ 2013-05-14 21:13 chenhuan001 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 用了#include <sstream> 来处理前面的数据,太好用了其他的就是用类似tarjan的算法来求割点.NetworkTime Limit:1000MSMemory Limit:10000KTotal Submissions:7537Accepted:3546DescriptionA Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N . N 阅读全文
posted @ 2013-05-14 09:49 chenhuan001 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 狠狠的复杂度 n*n*n*n*m 。。。 你是在开玩笑嘛。。求最小割集的办法,枚举两个不相邻的点分别作为源点和汇点, 看流过的流量为多少, 为了体现一个点只能用一次所有每个点要拆成两个点Cable TV NetworkTime Limit:1000MSMemory Limit:30000KTotal Submissions:3424Accepted:1593DescriptionThe interconnection of the relays in a cable TV network is bi-directional. The network is connected if there 阅读全文
posted @ 2013-05-14 08:15 chenhuan001 阅读(362) 评论(0) 推荐(0) 编辑
上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 52 下一页