摘要: 题目来源:https://www.luogu.com.cn/problem/P1892 题目答案:https://www.luogu.com.cn/record/230792958 这个是接上上一道拆点并查集的,道理很简单还是就合并就好了,但是要想通为什么合并了就可以使“敌人的敌人变成朋友”: 比如 阅读全文
posted @ 2025-08-15 12:33 yubai111 阅读(4) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P1525 答案导航:https://www.luogu.com.cn/record/230217157 没有学过拆点并查集,想了很久,用普通并查集+map(map用于维护互斥的点),但是有很多细节要抠,真的很复杂,A不出来 阅读全文
posted @ 2025-08-11 15:29 yubai111 阅读(4) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P3799 ` define int long long using namespace std; int a[5010]; const int MOD = 1e9 + 7;//不要忘记取模 int Ccal(int x, 阅读全文
posted @ 2025-08-05 13:08 yubai111 阅读(9) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P1433 披着搜索皮的状压dp模板题!(但是好像也没有很简单的样子), 阅读全文
posted @ 2025-08-04 15:17 yubai111 阅读(4) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P1364 这道题因为是数据范围比较小,用bfs硬过的,但是看标签似乎还有dp和重心的做法,等到后面统一整理dp的时候可以考虑再做一遍。 阅读全文
posted @ 2025-08-04 13:39 yubai111 阅读(6) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P1825 代码导航:https://www.luogu.com.cn/record/228645977 我是绝对不会说这道题我WA卡了半个小时是因为偷懒用了vs里的ai自动填充代码功能!我是绝对不会说出来的! 阅读全文
posted @ 2025-08-03 22:55 yubai111 阅读(2) 评论(0) 推荐(0)
摘要: 题目导航:https://www.luogu.com.cn/problem/P3743 思路题,想通了很简单,想不通会被小数除法搞懵, 注:注意一下数据范围 阅读全文
posted @ 2025-07-31 10:45 yubai111 阅读(5) 评论(0) 推荐(0)
摘要: 基础思路:答案是具有连续性的,它首先一定可以通过for循环一个个枚举出来判断是不是真正答案,在此基础上想要优化,才应该想到‘二分’这个算法。大多数时候,二分是复合在别的算法中出现的小优化。 二分的板子不算难抄,但是有很多随机应变的小问题: 1、二分L和R的边界问题。打个比方:洛谷P1182(数列分段 阅读全文
posted @ 2025-07-29 10:54 yubai111 阅读(12) 评论(0) 推荐(0)
摘要: 题目来源:https://www.luogu.com.cn/problem/P2895 代码导航:https://www.luogu.com.cn/record/226995923 简单的bfs,但是容易出问题: debug第一次: if (nx >= 0 && ny >= 0) { if (mp[ 阅读全文
posted @ 2025-07-26 15:51 yubai111 阅读(4) 评论(0) 推荐(0)
摘要: 题目导航:https://codeforces.com/gym/105910 int main() { int T; cin >> T; while (T--) { int n; cin >> n; int haveans = 0; int all = 0; int du[1000010]; int 阅读全文
posted @ 2025-07-25 13:08 yubai111 阅读(3) 评论(0) 推荐(0)