摘要: 最新版本:1.2-beta 阅读全文
posted @ 2018-01-26 19:20 爱种树的码农 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 首先最优解时每个数如果作为顺子,那么只可能为1次或者2次。首先将所有非0个数变为1或者2。在考虑特殊情况,对于某区间1 1 2 1 1时,用作两个顺子会更优。 同理 1 1 2 1 2 1 1等等类似的也是这样,总结可得1 1 2或者1 1 1化为顺子为最优解,剩下的2都为对子。 阅读全文
posted @ 2017-09-02 18:34 爱种树的码农 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 归并树: 划分树: 阅读全文
posted @ 2017-08-28 16:46 爱种树的码农 阅读(149) 评论(0) 推荐(0) 编辑
摘要: E - Don't Be a Subsequence Time limit : 2sec / Memory limit : 256MB Score : 600 points Problem Statement A subsequence of a string S is a string that 阅读全文
posted @ 2017-08-23 17:27 爱种树的码农 阅读(140) 评论(0) 推荐(0) 编辑
摘要: dp[i][j]代表s1的前i个字符和s2的前j个字符匹配的情况,记录此时s2[j-1]匹配的字符。-1代表不匹配,0代表s2[j-1]匹配空字符。 阅读全文
posted @ 2017-08-22 20:23 爱种树的码农 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 数据好像极限,按理来说二分是可以过得,就是被卡主 阅读全文
posted @ 2017-08-20 18:08 爱种树的码农 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 去重合并,以某个点为起点,向后二分到最后一个满足未签到天数<=m的点。 二分时的查询有很多方法,可以用线段树,dp,前缀数组等等。比赛时没有想到前缀数组,就用来dp来完成查询,查询一次大约O(logn)。前缀数组的话查询O(1)更快一些。 同学说尺取法也可以。 dp[i][j]代表第i个区间到第i+ 阅读全文
posted @ 2017-08-13 19:34 爱种树的码农 阅读(146) 评论(0) 推荐(0) 编辑
摘要: RMQ变形一下,dp[0,1][i][j]代表为奇偶时的最小数的下标,每次在给定区间查找 奇数位最小偶数位最小的数对 或者 偶数位最小奇数位最小的数对。 再求一下左区间和右区间和数对内区间,三个区间无序,但是父区间和子区间是有序的,用优先队列对树排下序是一个很好的选择。 阅读全文
posted @ 2017-08-08 17:13 爱种树的码农 阅读(152) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include #include #define ll long long #define pb push_back #define max(x,y) ((x)>(y)?(x):(y)) #define min(x,y) ((x)>(... 阅读全文
posted @ 2017-08-04 16:24 爱种树的码农 阅读(115) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include #include #define ll long long #define pb push_back #define max(x,y) ((x)>(y)?(x):(y)) #define min(x,y) ((x)>(... 阅读全文
posted @ 2017-08-02 16:08 爱种树的码农 阅读(118) 评论(0) 推荐(0) 编辑