上一页 1 2 3 4 5 6 7 8 ··· 28 下一页
摘要: L. Controllers 思路: #include <bits/stdc++.h> #define int long long #define rep(i, a, b) for(int i = (a); i <= (b); ++i) #define fep(i, a, b) for(int i 阅读全文
posted @ 2024-03-04 16:32 cxy8 阅读(5) 评论(0) 推荐(0) 编辑
摘要: C. Serval and Toxel's Arrays 这种题目做多了应该很容易从贡献的角度去考虑了。 考虑当前版本对答案的贡献,首先这个版本和其他版本取交集至少会包含它本身所以直接先把\(i * n\)给加上去,然后再考虑,前面版本中出现的数当前版本并没有出现的这一部分如何去维护。 下面是怎么去 阅读全文
posted @ 2024-03-04 14:57 cxy8 阅读(3) 评论(0) 推荐(0) 编辑
摘要: C. Min Max Sort 很不错的一道题目,不过脑电波和出题人每对上,\(qwq。\) 正难则反。 我们考虑最后一步是怎么操作的。 最后一步一定是对\(1\)和\(n\)进行操作 那么上一步呢? 上一步应该是对\(2\)和\(n-1\) 以此类推 第一步应该是对\(\frac{n}{2}\)和 阅读全文
posted @ 2024-03-03 17:18 cxy8 阅读(1) 评论(0) 推荐(0) 编辑
摘要: C. Tea Tasting 思路 这里枚举有三种思路 然后经过考虑3是最可行的,然后接着考虑如何计算贡献 这里在实现的时候用了一个差分数组,因为我们需要记录第i个茶师它喝了多少个\(b_i\)以及不满\(b_i\)的用\(c_i\)记录,最后计算一下答案即可。 #include <bits/std 阅读全文
posted @ 2024-03-03 17:05 cxy8 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 思路: dp还是挺明显的,思路可以参考最长上升子序列 有点dp的感觉 \(f[i]\)表示考虑前\(i\)个数,的最大值 当前数有两种删或不删 不删:\(f[i]=f[i-1]\); 删:\(f[i]=max{f[j-1]+i-j+1}\) 这个转移是\(O(n^2)\)的显然时间上来不及 考虑优化 阅读全文
posted @ 2024-02-29 09:28 cxy8 阅读(1) 评论(0) 推荐(0) 编辑
摘要: G. The Morning Star 思路:用map记录x,y,以及y-x、y+x 从前往后统计一遍答案即可 公式\(ans+=cnt[x]+cnt[y]-2 * cnt[x,y]+cnt[y+x]+cnt[y-x]\) \(cnt[x]+cny[y]-2 * cnt[x,y]\)是统计坐标轴方向 阅读全文
posted @ 2024-02-29 08:48 cxy8 阅读(1) 评论(0) 推荐(0) 编辑
摘要: E. Power of Points 题解参考 #include <bits/stdc++.h> #define int long long #define rep(i, a, b) for(int i = (a); i <= (b); ++i) #define fep(i, a, b) for(i 阅读全文
posted @ 2024-02-28 20:15 cxy8 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 目录ABCDEFGHIJKL A n的范围很小暴力直接\(O(n^3)\)直接做就行。 我还傻的统计了一下前后缀,不过怎么写都行这道题。 #include <bits/stdc++.h> #define int long long #define rep(i,a,b) for(int i = (a) 阅读全文
posted @ 2024-02-27 14:38 cxy8 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 目录链接题面题意题解代码总结 链接 D - Only one of two 题面 题意 求第\(k\)个只能被\(N\)或\(M\)整除的数 题解 \([1,x]\)中的能被\(n\)整除的数有\(\lfloor \frac{x}{n} \rfloor\)个 \([1,x]\)中的能被\(m\)整除 阅读全文
posted @ 2024-02-26 10:47 cxy8 阅读(16) 评论(0) 推荐(0) 编辑
摘要: A 两种情况 两个字符相同只有2 两个字符不相同4 #include <bits/stdc++.h> #define int long long #define rep(i,a,b) for(int i = (a); i <= (b); ++i) #define fep(i,a,b) for(int 阅读全文
posted @ 2024-02-26 09:50 cxy8 阅读(3) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 28 下一页