摘要: ## 普通并查集 管理元素所属集合的树形数据结构,实现为一棵森林,每一颗树都是一个集合,每个结点的元素指向其父节点。 并查集支持两种基本操作:**合并:**合并两个元素所属集合(合并对应的树),把一个根结点连在另一个根结点下。**查找:**查询某个元素所属集合(查询对应的树的根节点),这样可以判断两 阅读全文
posted @ 2023-07-06 11:12 wuyoudexian 阅读(27) 评论(0) 推荐(0)
摘要: ## BFS求最短路 BFS可用于求无权图的最短路,时间复杂度为$O(m)$,$m$为图上边的数量。 ## Floyd算法 Floyd算法用于求任意两点的最短路径,适用于任意图,无论有向无向,正权负权,它能一次性求出所用节点之间的距离。时间复杂度为$O(n^3)$,$n$为节点数量。 设$dp[i] 阅读全文
posted @ 2023-07-05 13:23 wuyoudexian 阅读(25) 评论(0) 推荐(0)
摘要: c题好难。 ## A. Game with Board [Problem - A - Codeforces](https://codeforces.com/contest/1841/problem/A) ### 题意 给定若干个数字1,Alice和Bob每回合合并两个相同的数字,Alice先手。如果 阅读全文
posted @ 2023-07-04 19:56 wuyoudexian 阅读(55) 评论(0) 推荐(0)
摘要: D题补了一天... ## B. Maximum Strength [Problem - B - Codeforces](https://codeforces.com/contest/1834/problem/B) ### 题意 给定两串数字,在这两串数字之间找两串数字,要求每一数位之差的绝对值之和最 阅读全文
posted @ 2023-07-04 19:46 wuyoudexian 阅读(38) 评论(0) 推荐(0)
摘要: 洛天依专场QWQ ## A. LuoTianyi and the Palindrome String [Problem - A - Codeforces](https://codeforces.com/contest/1825/problem/A) ### 题意 给定一个回文串,求最长的非回文子串的 阅读全文
posted @ 2023-07-04 19:24 wuyoudexian 阅读(23) 评论(0) 推荐(0)
摘要: vp时A题没写出来,场外找的答案,原来思路错了(心虚 ## A. Trust Nobody [Problem - A - Codeforces](https://codeforces.com/contest/1826/problem/A) ### 题意 有n个人,其中一些人只说真话,另外一些人只说谎 阅读全文
posted @ 2023-07-04 19:18 wuyoudexian 阅读(24) 评论(0) 推荐(0)
摘要: vp过三题,c是交互题,想起了打华师大校赛时的不愉快经历了。 ## A.Li Hua and Maze [Problem - A - Codeforces](https://codeforces.com/contest/1797/problem/A) ### 题意 给定一个n×m的矩阵,矩阵中有两个 阅读全文
posted @ 2023-07-04 19:09 wuyoudexian 阅读(31) 评论(0) 推荐(0)
摘要: vp中途突然拉肚子>_ using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; array dp; for(int 阅读全文
posted @ 2023-07-04 19:03 wuyoudexian 阅读(20) 评论(0) 推荐(0)
摘要: 卡B题了,难受 ## B. qsgg and Subarray [B-qsgg and Subarray_牛客练习赛112 (nowcoder.com)](https://ac.nowcoder.com/acm/contest/59717/B) ### 题意 给定一个长为n的序列,求有多少个子区间的 阅读全文
posted @ 2023-07-04 18:44 wuyoudexian 阅读(38) 评论(0) 推荐(0)