Description: 规定对于一个只有大写字母的字符串是有大小顺序的。如ABCD.即A_#include#include#include#includeusing namespace std;int map[27][27];int degree[27];int top[27];int tot;i...
分类:
编程语言 时间:
2015-06-08 06:13:03
阅读次数:
173
A direct applicatin of the heap data structure. Specifically, a max heap is used. The required functions include insertion of a node to the heap and e...
分类:
其他好文 时间:
2015-06-07 17:26:01
阅读次数:
109
The key of this problem is that we need not build the tree from scratch. In fact, we can direct obtain its post-order traversal results in a recursive...
分类:
其他好文 时间:
2015-06-07 17:19:23
阅读次数:
117
This is a application of the Trie data structure, with minor extension. The critical part in this problem is to count all the words that have a partic...
分类:
其他好文 时间:
2015-06-07 17:06:56
阅读次数:
93
题目1 : 欧拉路·一时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Hi和小Ho最近在玩一个解密类的游戏,他们需要控制角色在一片原始丛林里面探险,收集道具,并找到最后的宝藏。现在他们控制的角色来到了一个很大的湖边。湖上有N个小岛(编号1..N),以及连接小岛的M座木桥。每座...
分类:
其他好文 时间:
2015-06-06 21:53:37
阅读次数:
199
#1145 : 幻想乡的日常时间限制:20000ms单点时限:1000ms内存限制:256MB描述幻想乡一共有n处居所,编号从1到n。这些居所被n-1条边连起来,形成了一个树形的结构。每处居所都居住着一个小精灵。每天小精灵们都会选出一个区间[l,r],居所编号在这个区间内的小精灵一起来完成一项任务。...
分类:
其他好文 时间:
2015-06-06 18:04:17
阅读次数:
123
#1135 : Magic Box时间限制:10000ms单点时限:1000ms内存限制:256MB描述The circus clown Sunny has a magic box. When the circus is performing, Sunny puts some balls into ...
分类:
其他好文 时间:
2015-06-06 14:42:33
阅读次数:
223
很显然地一个拓扑排序。根据题意很容易能够构图,由于需要求所有的拓扑序列,于是dfs,我们通过记录edge来修复in[].代码质量很烂,vis完全可以用in=-1的情况替代,这里注意到memset赋值的大小问题。以及一直WA,原因在于,total并没有初始化为零,虽然在最开始初始化了,但是后来会被修改...
分类:
其他好文 时间:
2015-06-05 19:14:17
阅读次数:
119
并查集+拓扑排序把等号的那些东西都用并查集合并一下,这样一来,建立邻接表的时候用根来建立就好了。然后就是拓扑排序。如果有两个入度为0的节点,那么说明肯定是条件不足,如果有成环的肯定是没法排序了。#include#include#include#include#includeusing namespa...
分类:
其他好文 时间:
2015-06-04 15:23:31
阅读次数:
98
One of my friends is always drunk. So, sometimes I get a bit confused whether he is drunk or not. So, one day I was talking to him, about his drinks! He began to describe his way of drinking. So, let m...
分类:
编程语言 时间:
2015-06-03 11:59:10
阅读次数:
186