上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 65 下一页
摘要: 原题链接 题解 在日期上设计 无后效性 但是 \(1e9\) 发现真空点去掉对答案也没有影响,故对所有线段的端点离散化处理,然后再做无后效性处理 code #include<bits/stdc++.h> #define ll long long using namespace std; const 阅读全文
posted @ 2024-07-28 15:41 纯粹的 阅读(34) 评论(0) 推荐(0)
摘要: 原题链接 题解 很巧妙的一道题 对于任意给定的的 \(nm\) 矩阵,有且仅有一种构造方法使得 \((n+1)(m+1)\) 矩阵为合法 阅读全文
posted @ 2024-07-28 14:52 纯粹的 阅读(12) 评论(0) 推荐(0)
摘要: 原题链接 题解 看到“最大值”“曼哈顿距离”,我们不禁想到转换成切比雪夫距离之后求最大值 code #include<bits/stdc++.h> #define ll long long using namespace std; const ll inf=1e8; struct node { ll 阅读全文
posted @ 2024-07-28 14:31 纯粹的 阅读(27) 评论(0) 推荐(0)
摘要: 原题链接 题解 对于点 \((a_1,b_1),(a_2,b_2)\) 的切比雪夫距离,可以看做成点 \((\frac{a_1+b_1}{2},\frac{a_1-b_1}{2}),(\frac{a_2+b_2}{2},\frac{a_2-b_2}{2})\) 的曼哈顿距离 不信你分类讨论看看 某一 阅读全文
posted @ 2024-07-28 14:07 纯粹的 阅读(27) 评论(0) 推荐(0)
摘要: 原题链接 题解 暴力:二进制表示所有状态 为了减少重复运算:设计一个数组,代表 \(x\) 为某值的时候最小的 \(y\) 但是还需要知道吃了多少个:再加一层状态不就好了 code #include<bits/stdc++.h> #define ll long long using namespac 阅读全文
posted @ 2024-07-28 12:29 纯粹的 阅读(25) 评论(0) 推荐(0)
摘要: 原题链接 题解 when you are asked to find the “k-th whatever-est something,” binary search is often adopted as the first step of the solution 以 \(d_k\) 为半径的线 阅读全文
posted @ 2024-07-28 12:03 纯粹的 阅读(43) 评论(0) 推荐(0)
摘要: 原题链接 题解 把美丽看成 1+有多少相邻的不同的连接块 这样就能贡献来做了 code #include<bits/stdc++.h> #define ll long long using namespace std; ll a[100005]; void solve() { ll n,q; cin 阅读全文
posted @ 2024-07-28 10:40 纯粹的 阅读(23) 评论(0) 推荐(0)
摘要: 原题链接 题解 关系具有矢量特性,因此可以带权并查集维护 code #include<bits/stdc++.h> #define ll long long using namespace std; int fa[50006]; int val[50006]; int finds(int now) 阅读全文
posted @ 2024-07-27 16:23 纯粹的 阅读(24) 评论(0) 推荐(0)
摘要: 原题链接 题解 暴力方法: 遍历每个节点,遍历每个节点的子节点,遍历每个子节点的子节点,看看子子节点是否是节点的子节点,时间复杂度 \(O(nm^2)\) 优化 考虑无向边建边的时候建成有向边,且两个点建边时,度数小的指向度数大的,如果度数相等,编号小的指向编号大的(其实这一步是为了避免重复计数)( 阅读全文
posted @ 2024-07-27 13:01 纯粹的 阅读(27) 评论(0) 推荐(0)
摘要: 原题链接 题解 贪心的每次挑选当前最大的,但是要挑选k次,因此我们没法去遍历挑选的过程,因此我们考虑最终形态,由于每次挑选最大的元素,因此最后所有数一定不超过某个数,二分由此而来 code #include<bits/stdc++.h> #define ll long long using name 阅读全文
posted @ 2024-07-27 12:05 纯粹的 阅读(9) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 65 下一页