Bob is very interested in the data structure of a tree. A tree is a directed graph in which a special node is singled out, called the "root" of the tree, and there is a unique path from the root to each of the other nodes.
Bob intends to color all the no...
分类:
其他好文 时间:
2015-02-06 21:55:57
阅读次数:
221
这是一个比较全面的题,涉及到了添加删除寻找第k大还有树的合并。做法大概先执行所有的删边操作,建立最终的图,这里可以用并查集维护一下, 方便判断是不是在一个联通块中,然后对每个子块建立一个Treap,如果遇到添加边导致两个联通块合并成一个的情况,就将两棵树当中小的那个合并到大的那个里面。因为每次这样的...
分类:
其他好文 时间:
2015-02-06 12:58:14
阅读次数:
190
Clone GraphClone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are l...
分类:
其他好文 时间:
2015-02-05 18:16:25
阅读次数:
220
1. OGNL
1.1. OGNL介绍
1.1.1. 什么是OGNL
Object Graph Navigation Language,是一门功能强大的表达式语言,类似于EL。
1.1.2. 为什么用OGNL
OGNL表达式功能很强大,后面我们会重点阐述。而Struts2默认采用OGNL表达式访问Action的数据,实际上是通过ValueStack用封装后...
分类:
其他好文 时间:
2015-02-05 13:40:01
阅读次数:
132
题目大意:求n个点能组成多少种无向连通图
多年的老心病终于干掉了- -
令f[i]表示i个点能组成多少种无向图
首先易知我们能生成2^(i*(i-1)/2)种图 但是一些是不合法的 我们要将不合法的干掉
枚举1号节点与多少个点连通
设1号节点所在联通块大小为j(1
那么与1相连的其它点有C(i-1,j-1)中选法,1号节点所在联通块有f[j]种连法,不与1号节点相连的点有2^((i-j...
分类:
其他好文 时间:
2015-02-05 11:16:19
阅读次数:
101
OGNL概述
Object-Graph Navigation Language,对象图导航语言
1、能够访问对象的方法,如list.size()
2、能够访问静态属性与静态方法,需要在类名前加上@,如@java.lang.Math@PI,@java.lang.String@format('foo %s','bar')
3、支持赋值操作和表达式串联,如赋值#value=5
4、访问OG...
分类:
其他好文 时间:
2015-02-05 09:33:23
阅读次数:
169
题意:给定一些任务,和任务序列 i j,意思是要求任务 i 必须要在任务 j 前完成。给出这样的任务序列。
思路:拓扑排序。
注意的是任务是从1开始的到n。
Code:
#include
#include
bool dfs(int u,int n);
bool toposort(int n);
int graph[105][105];
int topo[105];
int t;
in...
分类:
编程语言 时间:
2015-02-04 21:49:34
阅读次数:
226
拓扑排序:对有向图的所有结点排序,使得每一条有向边(u,v)对应的u都排在v的前面。
如果图中存在有向环,则不存在拓扑排序,反之则存在。把不包含有向环的有向图称为有向无环图(Directed Acyclic Graph,DAG)。
//因为查找的是有向边(u,v),所以在放置u之前需要把比u偏序大的所有的v放置好。
//所以,所有元素的放置是从后往前放的。
//用到的vis数组,vis[u]=...
分类:
编程语言 时间:
2015-02-04 20:26:34
阅读次数:
255
链接:click here
题意:Network flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted directed graph.
翻译:网络流量是一个众所周知的难题ACMers。给定一个图,...
分类:
其他好文 时间:
2015-02-03 19:39:49
阅读次数:
245
题意:
思路:
Code:
#include
#include
bool solve();
void dfs(int n);
int graph[51][51];
int du[51];
int path[1010*2];
int len;
int main()
{
//freopen("10054.in","r",stdin);
//freopen("10054.out","...
分类:
其他好文 时间:
2015-02-03 19:29:27
阅读次数:
160