上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 15 下一页
摘要: //[7/29/2014Sjm]/*时间复杂度:O(nlogn)实现方式:树状数组or线段树逆序数:在一个排列中,若一对数,前面的数大于后一个数(即位置顺序和大小顺序相反),就称它们为一个逆序。排列中,逆序的总数即称为此排列的逆序数。 求逆序数方法:树状数组或线段树(1)树状数组实现方法:参见树状数... 阅读全文
posted @ 2014-07-29 14:42 JmingS 阅读(175) 评论(0) 推荐(0) 编辑
摘要: //[7/29/2014Sjm]/*线段树称断更新。。。关键lazy思想,保存增量,更新时只更新到某一段,不再向下更新,待再次更新或查询到此段时,对其子节点进行更新。。*/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 u... 阅读全文
posted @ 2014-07-29 09:42 JmingS 阅读(117) 评论(0) 推荐(0) 编辑
摘要: Your Ride Is Here:模拟一下题意过程,就可以了。。。 1 /* 2 ID: Jming 3 PROG: ride 4 LANG: C++ 5 */ 6 #include 7 #include 8 #include 9 #include 10 using namespace st... 阅读全文
posted @ 2014-07-28 20:18 JmingS 阅读(218) 评论(0) 推荐(0) 编辑
摘要: /*话说之前读题都没读懂。。。EachsubstringofAwithlengthequaltoorlargerthan4canappearinthestringexactlyonce.A的每个长度大于等于4的子串出现在传中恰好一次。(即:大于等于4的子串不能重复出现) 跟大神学的一种方法。。。首先... 阅读全文
posted @ 2014-07-27 15:32 JmingS 阅读(219) 评论(0) 推荐(0) 编辑
摘要: //[7/26/2014Sjm]/*此题看懂题意,就可以了。。。模拟+最短路。。。*/ 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 typedef __int64 int64; 7 const in... 阅读全文
posted @ 2014-07-26 23:10 JmingS 阅读(163) 评论(0) 推荐(0) 编辑
摘要: //[7/25/2014Sjm]/*好几次RuntimeError(ACCESS_VIOLATION)。。。后来发现:当有符号数和无符号数出现在同一个表达式中,默认状态下(不做强制类型转换)表达式的值为将结果转化为无符号类型的值。eg:intas=4;stringstr="abc";cout 3 #... 阅读全文
posted @ 2014-07-26 22:58 JmingS 阅读(222) 评论(0) 推荐(0) 编辑
摘要: //[7/26/2014Sjm]/*此题要求的值是:theminimumsumofallarrivaltimetoeachDogePlanet. 先用Floyd求任意两点之间的距离,再用Dfs去求最优解。。。。 不过关键在剪枝。。能力太水了,一直TLE,,,最后在大神的帮助下过的。。。。在两个地方剪... 阅读全文
posted @ 2014-07-26 22:15 JmingS 阅读(278) 评论(0) 推荐(0) 编辑
摘要: //[7/25/2014Sjm]/*线段树单点更新水题。。。*/ 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define lson l, m, rt>1) 9 10 const int MAX_... 阅读全文
posted @ 2014-07-25 11:31 JmingS 阅读(124) 评论(0) 推荐(0) 编辑
摘要: //[7/24/2014Sjm]/*第一道用线段树做的题,照着大神的代码风格写的,,就当作线段树单点更新的模板吧。。。。(当年用树状数组做的:代码见这里)*/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 using na... 阅读全文
posted @ 2014-07-24 20:49 JmingS 阅读(203) 评论(0) 推荐(0) 编辑
摘要: //[7/24/2014Sjm]/*模拟一组测试数据:21051053561)若先选择第一组先来:背包所用容量:012345678910第一遍循环:00000000005第二遍循环:000006666662)若先选择第二组先来:背包所用容量:012345678910第一遍循环:00000666666... 阅读全文
posted @ 2014-07-24 12:12 JmingS 阅读(314) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 15 下一页