上一页 1 2 3 4 5 6 ··· 8 下一页
摘要: 对顶堆动态维护第k大的值。 #include<bits/stdc++.h> using namespace std; using i64=long long; void Showball(){ int n,w; cin>>n>>w; priority_queue<int,vector<int>,gr 阅读全文
posted @ 2024-10-22 14:47 Showball 阅读(12) 评论(0) 推荐(0) 编辑
摘要: AtCoder Beginner Contest 375 (A-G) 比赛链接 A - Seats #include<bits/stdc++.h> using namespace std; using i64=long long; void Showball(){ int n; string s; 阅读全文
posted @ 2024-10-21 15:32 Showball 阅读(15) 评论(0) 推荐(0) 编辑
摘要: AtCoder Beginner Contest 374 (A-E) 比赛链接 A - Takahashi san 2 #include<bits/stdc++.h> using namespace std; using i64=long long; void Showball(){ string 阅读全文
posted @ 2024-10-16 11:34 Showball 阅读(15) 评论(0) 推荐(0) 编辑
摘要: AtCoder Beginner Contest 373 (A-F) 比赛链接 A - September #include<bits/stdc++.h> using namespace std; using i64=long long; void Showball(){ int ans=0; fo 阅读全文
posted @ 2024-10-11 15:13 Showball 阅读(13) 评论(0) 推荐(0) 编辑
摘要: CF 577 B. Modulo Sum 鸽巢原理/01背包 题目链接 思路: 每个数可选可不选,经典的01背包问题,但是数据范围过大,因为要找可行解即可,考虑去找满足题意的子数组(子数组是特殊的子序列)。就变成一个经典的前缀和问题。只需要找到前缀和数组中存在两个相等的值,那么满足条件。由于需要取模 阅读全文
posted @ 2024-10-09 02:36 Showball 阅读(11) 评论(0) 推荐(0) 编辑
摘要: CF 1805 D. A Wide, Wide Graph (*1800) 思维 + 树的直径 题目链接 题意: 思路: 若当前点到最远的点的距离 <k , 说明 x 自己成为一个联通块。 并且我们知道距离任意一点最远的点一定是树直径的一个端点。 反之,则与直径端点在同一个联通块。 阅读全文
posted @ 2024-10-05 17:59 Showball 阅读(6) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round 974 (Div.3) 题解 A. Robin Helps 模拟 按照题意模拟即可。 void Showball(){ int n,k; cin>>n>>k; int cur=0,ans=0; for(int i=0;i<n;i++){ int x; cin>>x; 阅读全文
posted @ 2024-09-24 15:53 Showball 阅读(845) 评论(1) 推荐(2) 编辑
摘要: Codeforces Round 972(Div.2)题解 A. Simple Palindrome 贪心 贪心,尽可能元素数量平均,并且相同字母放在一起。 #include<bits/stdc++.h> using namespace std; #define ff first #define s 阅读全文
posted @ 2024-09-23 16:27 Showball 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round 973 (Div.2) A-E题解 比赛传送门 A. Zhan's Blender 数学 显然答案为 nmin(x,y)。 #include<bits/stdc++.h> using namespace std; 阅读全文
posted @ 2024-09-23 15:50 Showball 阅读(440) 评论(2) 推荐(1) 编辑
摘要: 莫队简单入门 补最近一场DIV.4 时遇到一道需要求区间众数的题目,完善一下技能树。 简介: 莫队是一种解决离线区间询问问题的方法。能够在 O(nn) 的时间复杂度内求出所有询问的答案。 大致流程: 1.将所有数据分块。有时需要离散化。 2.将所有询问离线,并排序。 3.对于区 阅读全文
posted @ 2024-09-06 16:32 Showball 阅读(48) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 8 下一页
点击右上角即可分享
微信分享提示