摘要: Description Input Output Solution 题意就是求最大的序列和相等的子序列个数 对于每一个子序列,显然当右边界越小的时候,后面选到的子序列的个数可能会更多 而且$n\leqslant 1500$,我们可以$n^{2}$暴力枚举 时间复杂度$O(n^{2})$ Code # 阅读全文
posted @ 2020-10-13 21:12 Sport_River 阅读(84) 评论(0) 推荐(0) 编辑
摘要: Description You are playing a computer card game called Splay the Sire. Currently you are struggling to defeat the final boss of the game. The boss ba 阅读全文
posted @ 2020-10-12 22:29 Sport_River 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Description Input Output 每组数据输出一行表示答案。 Solution Explanation 比赛的时候没注意到$Seed$的数据类型,然后调了好久😓 这道题观察到如果是扔出去的茶,肯定有两个性质: 1.已经被买过了 2.一定比它后面扔出去的茶先捡回来 我们先考虑只买茶的 阅读全文
posted @ 2020-10-10 12:32 Sport_River 阅读(108) 评论(0) 推荐(0) 编辑
摘要: Description Input Output Solution Explanation 题目真把我看吐了,又臭又长的题面完全没有阅读的欲望好吧 其实就是有$n+1$个数,已知第n+1个数是m,然后第1~n个数∈[1,m],求这些数互质的方案数 正难则反 容易得出总方案是$m^$的 我们再减去重复 阅读全文
posted @ 2020-10-09 15:00 Sport_River 阅读(77) 评论(0) 推荐(0) 编辑
摘要: Description Input Output Solution 比较明显的DP 设$f_{i,j}$表示做到第i行,分了j个矩形的方案数 转移明显: \(f_{i,j}=max(f_{k,j-1}+(i-k)*(r_{i}-l_{i}))\) 暴力做的话是$O(n^{2}k)$的,不能接受 考虑 阅读全文
posted @ 2020-10-09 14:49 Sport_River 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Description Input Output Solution 这题有好几个做法,这里介绍两个 Solution 1 (这似乎是网上的正解) From zsjzliziyang 设f[ i ][ j ]表示度数为1、2的点个数分别为i,j时答案。 分为下面的4种情况 1:当t2为0时我们新增若干 阅读全文
posted @ 2020-10-06 22:11 Sport_River 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Description You are planning to build housing on a street. There are n spots available on the street on which you can build a house. The spots are lab 阅读全文
posted @ 2020-09-24 20:46 Sport_River 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Description At the first holiday in spring, the town Shortriver traditionally conducts a flower festival. Townsfolk wear traditional wreaths during th 阅读全文
posted @ 2020-09-23 21:05 Sport_River 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Description Original Problem Chinese Translation 大概就是给你一个间隔为1的多米诺序列,推倒一个多米诺骨牌有个花费,求推倒所有多米诺骨牌的最小花费 Solution 这道题先处理出每一个点最左及最右可推倒的位置,这可以用栈维护 设以上位置为$l_$,\ 阅读全文
posted @ 2020-09-17 22:06 Sport_River 阅读(92) 评论(0) 推荐(0) 编辑
摘要: Description 在平面上堆叠着若干矩形,这些矩形的四边与平面X坐标轴或Y坐标轴平行。下图展示了其中一种情况,3个矩形的边将平面划分成8个区域: 下面展示了另一种稍稍复杂一些的情况: 你的任务是写一个程序,判断这些矩形将平面分成了几个区域。 Input 输入的第一行是一个正整数n(n<=50) 阅读全文
posted @ 2020-09-13 10:12 Sport_River 阅读(130) 评论(0) 推荐(0) 编辑