上一页 1 2 3 4 5 6 7 8 9 ··· 57 下一页

2016年2月15日

【HDOJ】4729 An Easy Problem for Elfness

摘要: 其实是求树上的路径间的数据第K大的题目。果断主席树 + LCA。初始流量是这条路径上的最小值。若a<=b,显然直接为s->t建立pipe可以使流量最优;否则,对【0, 10**4】二分得到boundry,使得boundry * n_edge - sum_edge <= k/b, 或者建立s->t,然 阅读全文

posted @ 2016-02-15 15:04 Bombe 阅读(263) 评论(0) 推荐(0) 编辑

【HDOJ】3727 Jewel

摘要: 静态区间第K大值。主席树和划分树都可解。 1 /* 3727 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 阅读全文

posted @ 2016-02-15 01:30 Bombe 阅读(119) 评论(0) 推荐(0) 编辑

【HDOJ】4251 The Famous ICPC Team Again

摘要: 划分树模板题目,主席树也可解。划分树。 1 /* 4251 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 8 阅读全文

posted @ 2016-02-15 00:30 Bombe 阅读(127) 评论(0) 推荐(0) 编辑

2016年2月14日

【HDOJ】4605 Magic Ball Game

摘要: 思路1:树状数组+离线处理,对所有的w离散化处理,边dfs边使用树状数组更新左右w的情况。思路2:主席树,边bfs边建树。结点信息存储cnt,然后在线查询。树状数组。 1 /* 4605 */ 2 #include <iostream> 3 #include <sstream> 4 #include 阅读全文

posted @ 2016-02-14 23:34 Bombe 阅读(152) 评论(0) 推荐(0) 编辑

【HDOJ】3473 Minimum Sum

摘要: 划分树解。主席树解MLE。 1 /* 3473 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 8 #incl 阅读全文

posted @ 2016-02-14 17:16 Bombe 阅读(165) 评论(0) 推荐(0) 编辑

2016年2月13日

【POJ】2104 K-th Number

摘要: 区间第K大数。主席树可解。 1 /* 2104 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 8 #incl 阅读全文

posted @ 2016-02-13 23:57 Bombe 阅读(162) 评论(0) 推荐(0) 编辑

【HDOJ】4355 Party All the Time

摘要: 好久没做过三分的题目了。 1 /* 4355 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 8 #inclu 阅读全文

posted @ 2016-02-13 22:33 Bombe 阅读(174) 评论(0) 推荐(0) 编辑

【HDOJ】4345 Permutation

摘要: 即求P1^n1+P2^n2 + ... + Pk^nk <= n,其中Pk为素数的所有可能组合。思路是DP。1~1000的素数就不到200个。dp[i][j]表示上式和不超过且当前最小素数为P[j]的所有可能情况。注意dp[i][0]+1即为所求。 1 /* 4345 */ 2 #include < 阅读全文

posted @ 2016-02-13 22:02 Bombe 阅读(173) 评论(0) 推荐(0) 编辑

【POJ】3468 A Simple Problem with Integers

摘要: 这题用线段树轻松解了,重新用树状数组解,关键点是区间更新。公式推导如下:sum[x] = org_sum[x] + delta[1]*x + delta[2]*(x-1) + delta[x]*1 = org_sum[x] + Sigma(delta[1..x]) * (x+1) - Sigma(d 阅读全文

posted @ 2016-02-13 17:54 Bombe 阅读(146) 评论(0) 推荐(0) 编辑

【HDOJ】4348 To the moon

摘要: 主席树区间更新,延迟标记。 1 /* 4348 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 8 #incl 阅读全文

posted @ 2016-02-13 17:37 Bombe 阅读(236) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 ··· 57 下一页

导航