会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Fighting Heart
Microsoft - Software Engineer
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
43
44
45
46
47
48
49
50
51
···
69
下一页
2016年2月20日
CodeForces 626A Robot Sequence
摘要: 枚举一下就好,时间复杂度o(n*n) #include<cstdio> #include<cstring> #include<cmath> #include<string> #include<vector> #include<queue> #include<algorithm> #include<i
阅读全文
posted @ 2016-02-20 16:16 Fighting_Heart
阅读(174)
评论(0)
推荐(0)
2016年2月19日
ZOJ 3780 Paint the Grid Again
摘要: 拓扑排序。2014浙江省赛题。 先看行: 如果这行没有黑色,那么这个行操作肯定不操作。 如果这行全是黑色,那么看每一列,如果列上有白色,那么这一列连一条边到这一行,代表这一列画完才画那一行 如果不全是黑色,那么看这一行的每一个元素,如果有白色的,那么白色所在列向这一行连边。 再看列: 与看行类似,不
阅读全文
posted @ 2016-02-19 15:09 Fighting_Heart
阅读(310)
评论(0)
推荐(0)
[期待神犇降临] 前几天想到的一个问题。
摘要: 手上有好多卡牌:卡牌分两种,A类和B类A类卡:仅有一个攻击力G[i],和一个血量HP[i]B类卡:有一个攻击力G[i],和一个血量HP[i],还有一个属性:每受到1点伤害,攻击力增加K[i] 现在轮到我攻击对方。每张卡可以攻击一次,可以攻击自己的卡牌也可以直接攻击对方。当卡牌的HP小于等于0的时候,
阅读全文
posted @ 2016-02-19 11:10 Fighting_Heart
阅读(295)
评论(1)
推荐(0)
HDU 2809 God of War
摘要: 状压DP。我认为是数据水了,用打死了哪几只作为状态,AC代码只需要保存当前状态的最大血量,完全没有考虑攻击力大小。 个人认为正确DP应该这样的:dp[状态][等级],但这样写不能AC,时间复杂度会很大,但答案应该是正确的。 #include<cstdio> #include<cstring> #in
阅读全文
posted @ 2016-02-19 10:37 Fighting_Heart
阅读(191)
评论(0)
推荐(0)
2016年2月18日
HDU 3362 Fix
摘要: 状压DP。 首先很容易想到:一个点要被固定的话,必须有两个已经固定了的点与这个点连边。 再看N的范围,秒想到状压DP,秒出思路。1表示这个点已经被固定,0表示还没被固定。 推导某个状态的时候,枚举一下这个状态下所有被固定的点哪个是最后被固定的,即可得出这个状态的最优解。 #include<cstdi
阅读全文
posted @ 2016-02-18 11:22 Fighting_Heart
阅读(349)
评论(0)
推荐(0)
2016年2月17日
HUST 1353 Dartboard
摘要: 构造。应该有多种构造方法。做的时候WA了好几发,怀疑做法是错的,事实上是代码写搓了。。 我是这样构造的:先从上往下左右放奇数,再从下往上左右填偶数 (一)如果n/2是偶数(以12为例) 左边列是内环,右边列是外环 (二)如果n/2是奇数(以10为例) 左边列是内环,右边列是外环 #include <
阅读全文
posted @ 2016-02-17 13:20 Fighting_Heart
阅读(228)
评论(0)
推荐(0)
HUST 1351 Group
摘要: (莫名其妙的被一个叫布布扣的网站收录了......什么鬼) 简单DP。dp[i][j]表示把前i个数字分成j段的最优解, 递推式很容易写: (其中sum[]是前缀和;p <= i - L,并且前p个数能分成j-1段,下文不再说明p的范围,都是一样的) 得到递推式之后暴力DP的话复杂度为o(n*n*k
阅读全文
posted @ 2016-02-17 10:57 Fighting_Heart
阅读(205)
评论(0)
推荐(0)
2016年2月16日
HUST 1354 Rubiks
摘要: 背包。注释写详细了。 本想这样写:每个组内各自做背包,然后组间做背包,但是由于这题M=10000,时间复杂度太大。 #include<cstdio> #include<cstring> #include<cmath> #include<queue> #include<vector> #include
阅读全文
posted @ 2016-02-16 19:07 Fighting_Heart
阅读(187)
评论(0)
推荐(0)
HDU 3681 Prison Break
摘要: 二分答案+状压DFS+BFS预处理 答案是通过二分得到的,每次得到的mid进行验证,验证可以状压DP也可以DFS DFS||DP的时候,如果一格一格走,会TLE。事实上我们只关心Y、G、F这几个格子的状态,对于S不知道情况对得到答案毫无影响,所以采用BFS预处理,求出Y、G、F这几个格子两两之间的最
阅读全文
posted @ 2016-02-16 12:40 Fighting_Heart
阅读(229)
评论(0)
推荐(0)
2016年2月15日
CodeForces 622D Optimal Number Permutation
摘要: 是一个简单构造题。 请观察公式: 绝对值里面的就是 |di-(n-i)|,即di与(n-i)的差值的绝对值。 事实上,对于任何n,我们都可以构造出来每一个i的di与(n-i)的差值为0。 换句话说,就是这个最小值一定可以构造出来是0。 假设输入是6:那么可以这样构造:1 3 5 5 3 1 2 4
阅读全文
posted @ 2016-02-15 12:24 Fighting_Heart
阅读(307)
评论(0)
推荐(1)
CodeForces 622A Infinite Sequence
摘要: 简单题,公式打了个表,查询的时候二分一下就行。也可以直接o(1)公式出解。 #include <stdio.h> #include <algorithm> #include <string.h> #include <queue> #include <stack> #include <map> #in
阅读全文
posted @ 2016-02-15 10:17 Fighting_Heart
阅读(166)
评论(0)
推荐(0)
CodeForces 622B The Time
摘要: 水题。 #include <stdio.h> #include <algorithm> #include <string.h> #include <queue> #include <stack> #include <map> #include <vector> using namespace std
阅读全文
posted @ 2016-02-15 10:03 Fighting_Heart
阅读(137)
评论(0)
推荐(0)
CodeForces 622C Not Equal on a Segment
摘要: 预处理p[i],p[i]表示:【p[i],i】这段闭区间上所有数字都是a[i] 询问的时候,如果xi==a[ri]并且p[ri]<=li,一定无解 剩下的情况都是有解的,如果xi!=a[ri],那么输出ri,否则输出p[ri]-1。 另外,看到有大牛博客说可以用线段树,大致是这样的: 线段树保存区间
阅读全文
posted @ 2016-02-15 09:25 Fighting_Heart
阅读(221)
评论(0)
推荐(0)
2016年2月14日
HDU 5624 KK's Reconstruction
摘要: 这题目测是数据水了。我这种暴力写法显然是可以卡超时的。 假设有2000个点,15000条边,前面10000条不能构成树,后面5000条可以,这种数据显然可以卡超时。 #include <stdio.h> #include <algorithm> #include <string.h> #includ
阅读全文
posted @ 2016-02-14 14:52 Fighting_Heart
阅读(257)
评论(0)
推荐(0)
HDU 5621 KK's Point
摘要: N个点中任意选取四个点,就能产生一个圆内的交点,所以圆内总共有C(N,4)个交点,圆上有N个,相加就可以了。 注意:组合数运算的时候会爆longlong,中间先除一下就可以了。 #include <stdio.h> #include <algorithm> #include <string.h> #
阅读全文
posted @ 2016-02-14 14:50 Fighting_Heart
阅读(202)
评论(0)
推荐(0)
HDU 5620 KK's Steel
摘要: 想了一下发现是斐波那契数列.....水题 #include <stdio.h> #include <algorithm> #include <string.h> #include <queue> #include <stack> #include <map> #include <vector> us
阅读全文
posted @ 2016-02-14 14:48 Fighting_Heart
阅读(138)
评论(0)
推荐(0)
CodeForces 625B War of the Corporations
摘要: 暴力匹配+一点判断 #include <stdio.h> #include <algorithm> #include <string.h> #include <queue> #include <stack> #include <map> #include <vector> using namespa
阅读全文
posted @ 2016-02-14 00:28 Fighting_Heart
阅读(343)
评论(0)
推荐(0)
CodeForces 625C K-special Tables
摘要: 简单构造 #include <stdio.h> #include <algorithm> #include <string.h> #include <queue> #include <stack> #include <map> #include <vector> using namespace st
阅读全文
posted @ 2016-02-14 00:28 Fighting_Heart
阅读(177)
评论(0)
推荐(0)
CodeForces 625A Guest From the Past
摘要: 贪心水题 #include <stdio.h> #include <algorithm> #include <string.h> #include <queue> #include <stack> #include <map> #include <vector> using namespace st
阅读全文
posted @ 2016-02-14 00:27 Fighting_Heart
阅读(227)
评论(0)
推荐(0)
CodeForces 625D Finals in arithmetic
摘要: 神奇的构造题,我的思路比较奇葩。搞了好久,看到WA on 91我绝望了,然后自己造数据,找到了错误,总算是AC了,现在是凌晨0:24分,看到AC之后,感动China! 我写的代码无比的长。。。。。应该有很简单的方法吧。。。。。没想到。 #include <stdio.h> #include <alg
阅读全文
posted @ 2016-02-14 00:26 Fighting_Heart
阅读(262)
评论(0)
推荐(0)
上一页
1
···
43
44
45
46
47
48
49
50
51
···
69
下一页
公告