摘要: 该题一下子就爆栈了,我还只能用G++可以提交,c++还是过不了;该题是一道LCA,这里就不重复了,(前面已经说了);#include<cstdio>#include<iostream>#include<string.h>#include<vector>using namespace std;class node{public: int en; int len; };vector<node>tree[40024],Qes[40024];int dis[40024],ans[40024],set[40024],visit[40024],a 阅读全文
posted @ 2012-01-07 21:45 wutaoKeen 阅读(256) 评论(0) 推荐(0)
摘要: 这是一道找最近祖先的问题,我用的是纯暴力的方法。#include<iostream>#include<cstdio>using namespace std;int father[10024];int father1[10024];int father2[10024];int main(){ int n,T,f,s; scanf( "%d",&T ); while( T-- ) { scanf( "%d" ,&n ); for( int i=0;i<=n;i++ ) father[i]=i; for( int 阅读全文
posted @ 2012-01-07 09:47 wutaoKeen 阅读(168) 评论(0) 推荐(0)