2015年9月18日

UVa-1218 - Perfect Service

摘要: d[u][0][1]=sum{d[v][0]}d[u][1][1]=d[u][1][0]=sum{min(d[v][0],d[v][1])}d[u][0][0]=sum{d[v][0]}-d[min][0]+d[min][1] (d[min][1]=min(d[v][1]))调了很久。。。。 看到... 阅读全文

posted @ 2015-09-18 01:26 windrises 阅读(228) 评论(0) 推荐(0) 编辑

2015年9月13日

Uva-1220 - Party at Hali-Bula

摘要: 树的最大独立集,但是要判断唯一性。有些像是dfs。另外发现std::ios::sync_with_stdio(0)不能与scanf并用! 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #define pb pu... 阅读全文

posted @ 2015-09-13 15:12 windrises 阅读(217) 评论(0) 推荐(0) 编辑

2015年9月10日

UVa-10003 - Cutting Sticks

摘要: 区间dp,O(n^3)的算法很容易想。先递增枚举区间的长度d,再枚举起点i,再枚举切点k(i 2 #include 3 #include 4 using namespace std; 5 const int maxn=55; 6 int l,n; 7 int p[maxn]; 8 int dp[ma... 阅读全文

posted @ 2015-09-10 00:52 windrises 阅读(210) 评论(0) 推荐(0) 编辑

2015年9月5日

UVa-1625 - Color Length

摘要: 这道题我硬是做了两天多。dp比较好写,但是预处理很难写。自己第一次没写出来,看lrj的,结果反而越看越发愣。但还是受了点启发,改用c[i][j]来表示第一个字符串拿出前i个,第二个字符串拿出前j个时有多少种字母是已经开始了,但还没有结束。 然后又因为memset而超时了,学到的教训就是如果大部... 阅读全文

posted @ 2015-09-05 17:11 windrises 阅读(299) 评论(2) 推荐(0) 编辑

2015年9月3日

UVa-11584 - Partitioning by Palindromes

摘要: 先用manacher找到以所有回文串,再暴力统计以每个字符为结尾的所有回文串,然后dp就容易了。最坏情况下是O(n^2) (之后看了一下,这题的时间发现居然是rank 4!) 1 #include 2 #include 3 #include 4 #include 5 #include 6 #defi... 阅读全文

posted @ 2015-09-03 18:20 windrises 阅读(321) 评论(0) 推荐(0) 编辑

2015年8月24日

UVa-12563 - Jin Ge Jin Qu hao

摘要: 最近一直在做dp的题,上周六的BC简直惨不忍睹,就做出来一道题最后还FST了。不管了,暂时还是少刷一些比赛吧。好久没有更新了。集训结束了,太弱,没劲去写感想。在学校待到26号,然后回家,9.2再来。 1 #include 2 #include 3 #include 4 using namespace... 阅读全文

posted @ 2015-08-24 13:15 windrises 阅读(402) 评论(3) 推荐(0) 编辑

2015年8月7日

UVa-12166 Equilibrium Mobile

摘要: 被多校虐的不要不要的,不过集训也过去一(大)半了吧。这道题前几天写了一下,感觉好麻烦就暂时没写了。今天又拿起来看一下,除了写错一个变量名导致WA了一发外,算是1Y吧,还是感觉很爽的。下面是我的代码。后来又看了别人的题解,有的是暴力枚举每一个点做的,比我的要好理解,不过我的时间复杂度肯定要低。还有一个... 阅读全文

posted @ 2015-08-07 20:15 windrises 阅读(501) 评论(0) 推荐(0) 编辑

2015年7月30日

加油

摘要: 最近做了不少很难的题,也没时间来更博客。努力努力再努力,加油加油再加油!!! 阅读全文

posted @ 2015-07-30 00:16 windrises 阅读(164) 评论(2) 推荐(0) 编辑

2015年7月24日

UVa-10129 - Play on Words

摘要: 欧拉回路,然后dfs判断是否联通。(新技能get)注意:在dfs判断是否联通的时候,要是写成有向图的话,则一定要从起点进行dfs,有不少博主写错了,由于这题UVa的数据貌似不强,所以也AC了==我写的是无向图。 1 #include 2 #include 3 #include 4 using nam... 阅读全文

posted @ 2015-07-24 23:43 windrises 阅读(218) 评论(0) 推荐(0) 编辑

不再刷“水题”!

摘要: 听队友的话,而且时间精力都不够! 阅读全文

posted @ 2015-07-24 15:41 windrises 阅读(146) 评论(0) 推荐(0) 编辑

UVa-839 - Not so Mobile

摘要: 在没有读完数据的时候,不能在中间就退出dfs。很好的一道题。 1 #include 2 #include 3 #include 4 using namespace std; 5 bool dfs(int &w) 6 { 7 int w1,d1,w2,d2; 8 scanf("%d%d... 阅读全文

posted @ 2015-07-24 13:52 windrises 阅读(151) 评论(0) 推荐(0) 编辑

UVa-679 - Dropping Balls

摘要: 直接模拟会超时 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxx=21; 6 int d,n; 7 bool f[1 2 #include 3 #include 4 using namespace std... 阅读全文

posted @ 2015-07-24 11:34 windrises 阅读(168) 评论(0) 推荐(0) 编辑

Round #313 (Div. 2) D. Equivalent Strings

摘要: 运气不错,这次cf大涨,居然是房间第二(要不是D题TLE了,就第一了)用string会TLE,用char加下标,还看到更牛的算法, 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxx=200010; 6 c... 阅读全文

posted @ 2015-07-24 01:37 windrises 阅读(162) 评论(0) 推荐(0) 编辑

UVa-12657 - Boxes in a Line

摘要: 用数组写感觉萌萌哒啊,本题可以写个link函数,更加方便 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxx=100010; 6 int r[maxx],l[maxx]; 7 int n,m; 8 long... 阅读全文

posted @ 2015-07-24 01:22 windrises 阅读(220) 评论(0) 推荐(0) 编辑

UVa-11988 - Broken Keyboard (a.k.a. Beiju Text)

摘要: 原来数组可以代替指针,涨姿势 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxx=100010; 6 char a[maxx]; 7 int next[maxx],cur,last; 8 int main(... 阅读全文

posted @ 2015-07-24 01:21 windrises 阅读(155) 评论(0) 推荐(0) 编辑

导航