会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
俄罗斯刺沙蓬
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
下一页
2023年3月9日
D. Book of Evil(树的直径+换根dp)
摘要: #include <bits/stdc++.h> #define debug1(a) cout << #a << '=' << a << endl; #define debug2(a, b) cout << #a << " = " << a << " " << #b << " = " << b <<
阅读全文
posted @ 2023-03-09 11:20 俄罗斯刺沙蓬
阅读(31)
评论(0)
推荐(0)
2023年3月7日
分组背包
摘要: 题目 https://leetcode.cn/problems/number-of-ways-to-earn-points/description/?orderBy=most_votes https://codeforces.com/problemset/problem/148/E 题意(仅第二题)
阅读全文
posted @ 2023-03-07 20:54 俄罗斯刺沙蓬
阅读(25)
评论(0)
推荐(0)
2023年3月6日
树形dp常见类型——换根dp
摘要: 题目 https://codeforces.com/problemset/problem/219/D https://leetcode.cn/problems/count-number-of-possible-root-nodes/ https://leetcode.cn/problems/mini
阅读全文
posted @ 2023-03-06 15:47 俄罗斯刺沙蓬
阅读(57)
评论(0)
推荐(0)
2023年3月4日
982. 按位与为零的三元组(位运算)
摘要: ## 题目 - https://leetcode.cn/problems/triples-with-bitwise-and-equal-to-zero/description/?orderBy=most_votes ## 思路 - *[参考灵神题解,非常易懂,总结一些方法](https://leet
阅读全文
posted @ 2023-03-04 10:34 俄罗斯刺沙蓬
阅读(38)
评论(0)
推荐(0)
2023年3月2日
C. Mikasa(位运算+贪心)
摘要: 题目 https://codeforces.com/problemset/problem/1554/C 题意 输入 t(≤3e4) 表示 t 组数据,每组数据输入两个整数 n 和 m,均在 [0,1e9] 范围内。 定义数组 a = [n xor 0, n xor 1, n xor 2, ...,
阅读全文
posted @ 2023-03-02 15:41 俄罗斯刺沙蓬
阅读(36)
评论(0)
推荐(0)
2023年2月26日
2569. 更新数组后处理求和查询(模板 + 普通线段树熟练掌握)
摘要: 题目 https://leetcode.cn/problems/handling-sum-queries-after-update/description/ 思路 操作2和操作3都非常好实现,直接累加一个和就行 关键在于操作1(nums1数组所有元素大小在0~1之间)翻转 线段树相比树状数组更好理解
阅读全文
posted @ 2023-02-26 21:22 俄罗斯刺沙蓬
阅读(45)
评论(0)
推荐(0)
6366. 在网格图中访问一个格子的最少时间(dijkstra在矩阵上的运用)
摘要: 题目 https://leetcode.cn/problems/minimum-time-to-visit-a-cell-in-a-grid/description/ 思路 首先,这是一个最短路问题 直接用朴素记忆化搜索或者bfs无法实现“反复横跳”这一功能(只有有两个点以上可以走,就可以走到任意一
阅读全文
posted @ 2023-02-26 19:51 俄罗斯刺沙蓬
阅读(36)
评论(0)
推荐(0)
2023年2月25日
2572. 无平方子集计数(状态压缩dp)
摘要: 题目 https://leetcode.cn/problems/count-the-number-of-square-free-subsets/ 思路 类似01背包优化的状态压缩dp(误) 首先按照数字分出是否有平方子集,然后再计数cnt[x] 枚举合法的数字(2 ~ 30),为什么不算1?因为所有
阅读全文
posted @ 2023-02-25 10:11 俄罗斯刺沙蓬
阅读(80)
评论(0)
推荐(0)
2023年2月21日
最长有效括号
摘要: 题目 最长有效括号 方法一:dp int longestValidParentheses(string s) { int ans = 0; stack<int> sta; sta.push(-1); for(int i = 0;i < s.size();i ++) { if(s[i] == '(')
阅读全文
posted @ 2023-02-21 19:02 俄罗斯刺沙蓬
阅读(29)
评论(0)
推荐(0)
2023年2月19日
E. Nearest Opposite Parity(多源最短路bfs)
摘要: 题目 Nearest Opposite Parity(多源最短路bfs) 题意 思路 多源最短路 代码 const int N = 2e5+10; int a[N]; vector<int> edge[N]; int dist[N]; int ans[N]; void bfs(vector<int>
阅读全文
posted @ 2023-02-19 15:45 俄罗斯刺沙蓬
阅读(103)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
下一页
公告
返回顶端