上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 52 下一页
摘要: http://poj.org/problem?id=3114 1 #include 2 #include 3 #include 4 #include 5 #define maxn 300000 6 using namespace std; 7 8 const int inf=1dis[u]+w) 95 { 96 dis[v]=dis[u]+w; 97 return true; 98 } 99 return false;100 }101 102 bool spfa(int src)103 {104 mems... 阅读全文
posted @ 2014-02-18 08:22 null1019 阅读(162) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=3592 1 #include 2 #include 3 #include 4 #include 5 #define maxn 300000 6 using namespace std; 7 8 const int inf=-1q;113 q.push(src);114 dis[src]=0;115 while(!q.empty())116 {117 int u=q.front();118 q.pop();119 visi[u]=fals... 阅读全文
posted @ 2014-02-16 17:19 null1019 阅读(234) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=2186 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define maxn 100001 7 using namespace std; 8 9 int dfn[maxn],low[maxn],belong[maxn],bcnt,bcc_clock,a[maxn],b[maxn],num[maxn],n,m,head[maxn],e; 10 stacks; 11 bool vis[maxn],flag[maxn]; 12 struct nod... 阅读全文
posted @ 2014-02-13 19:45 null1019 阅读(133) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=3694 1 #include 2 #include 3 #include 4 #define maxn 201105 5 using namespace std; 6 7 int e,low[maxn],dfn[maxn],dfs_clock,f[maxn],num,b[maxn],n,m,head[maxn]; 8 struct node 9 { 10 int v,next; 11 }p[maxn*2]; 12 int vis[maxn]; 13 14 void add(int u,int v) 15 ... 阅读全文
posted @ 2014-02-12 21:13 null1019 阅读(133) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=1195 1 #include 2 #include 3 #include 4 #define maxn 1026 5 using namespace std; 6 7 int a[maxn][maxn]; 8 int c[maxn][maxn]; 9 int S,x,y,aa,l,r,b,t,h,T;10 11 int lowbit(int x)12 {13 return x&(x^(x-1));14 }15 16 void update(int i,int j,int k)17 {18 while(i0)34 ... 阅读全文
posted @ 2014-02-11 16:11 null1019 阅读(172) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=2886 1 #include 2 #include 3 #include 4 #define maxn 500100 5 using namespace std; 6 7 typedef long long ll; 8 const int prime[16]= {1,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47}; 9 int n,k;10 struct node11 {12 int l,r,num;13 } tree[maxn*3];14 15 ll maxsum,bestnum;16 ... 阅读全文
posted @ 2014-02-11 10:46 null1019 阅读(203) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=2777注意:a可能比b大 1 #include 2 #include 3 #include 4 #define maxn 1000010 5 using namespace std; 6 7 int T,L,O,a,b,c; 8 char ch; 9 struct node 10 { 11 int l,r,co; 12 }tree[3*maxn]; 13 bool tab[31]; 14 15 void build(int l,int r,int i) 16 { 17 tree[i].co=1;... 阅读全文
posted @ 2014-02-10 19:18 null1019 阅读(154) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=2528这个题有个细节,整个区间的长度为10000000,而n最大只有1000,所以我们要进行离散化。 1 #include 2 #include 3 #include 4 #define maxn 10010 5 using namespace std; 6 7 bool tab[maxn]; 8 int l[maxn],r[maxn],x[maxn*3],num[maxn*3],tree[maxn*12]; 9 int c,n; 10 11 int binary_search1(int sum) 12 { 13 ... 阅读全文
posted @ 2014-02-10 14:25 null1019 阅读(217) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=3422 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define maxn 100000 7 using namespace std; 8 9 const int inf=1q; 34 q.push(s); 35 vis[s]=true; 36 while(!q.empty()) 37 { 38 int u=q.front();q.pop(); 39 ... 阅读全文
posted @ 2014-02-10 09:05 null1019 阅读(163) 评论(0) 推荐(0)
摘要: 1 #include 2 #include 3 #include 4 #define maxn 10000 5 using namespace std; 6 struct node 7 { 8 int s,e; 9 bool operator =end)39 {40 end=p[j].e;41 vis[j]=true;42 }43 }44 }45 ... 阅读全文
posted @ 2014-01-23 22:01 null1019 阅读(115) 评论(0) 推荐(0)
上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 52 下一页