随笔- 114
文章- 0
评论- 13
阅读-
31331
10 2024 档案
置换环
摘要:置换环 作用:求解数组排序元素间所需最小交换次数这类问题。 思想:置换环将每个元素指向其排序后应在的位置,最终首位相连形成一个环(若数字在最终位置,则其自身成环),可知元素之间的交换只会在同一个环内进行,而每个环内的最小交换次数为 。 则总交换次数:\(ans = \sum_{
阅读全文
Codeforces Round 981 (Div. 3) ABCDE
摘要:Codeforces Round 981 (Div. 3)ABCDE A. Sakurako and Kosuke 藕是看样例直接猜了结论😜 // AC one more times // nndbk #include <bits/stdc++.h> using namespace std; ty
阅读全文
2024 江西省赛 ACGHJK
摘要:2024 江西省赛 ACGHJK A. Maliang Learning Painting 思路:签到,加起来就行了。 // AC one more times // nndbk #include <bits/stdc++.h> using namespace std; typedef long l
阅读全文
2024 黑龙江省赛 BDIJK
摘要:The 19th Heilongjiang Provincial Collegiate Programming Contest BDIJK B. String 思路:连续的3个可以删掉,类似括号匹配,用栈模拟即可。 // AC one more times // nndbk #include <bi
阅读全文
河南萌新联赛2024第(二)场 ADEFGHIJ
摘要:河南萌新联赛2024第(二)场 ADEFGHIJ A-国际旅行Ⅰ 思路:因为都是连通的,所以直接排序就行了。 // AC one more times // nndbk #include <bits/stdc++.h> using namespace std; typedef long long l
阅读全文
2020 CCPC河南省赛 ABCEI
摘要:2020 CCPC河南省赛 A - 班委竞选 签到不多说 // AC one more times // nndbk #include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9 + 7
阅读全文
2024 东北四省省赛 ADEJ
摘要:The 2024 CCPC National Invitational Contest (Northeast) ADEJ A.PaperWatering 思路:有两种类型的操作,对一个数开根号或平方。 平方没有什么问题,开根号由于是向下取整再平方就会产生不一样的数。 那么做法也很简单了。 对于一个数
阅读全文
Codeforces Round 978 (Div. 2) C. Gerrymandering 轮廓DP
摘要:Codeforces Round 978 (Div. 2) C轮廓DP C. Gerrymandering 思路:考虑有哪些情况呢? 发现结尾只有三种情况,0.平的,1.上凸,2.下凸。 那么每一种后面能出现什么呢? 这样看起来就好写啦。 // AC one more times // nndbk
阅读全文
2024 CCPC长春邀请赛 IGLE
摘要:2024CCPC长春邀请赛IGLE I. The Easiest Problem 签到 // AC one more times // nndbk #include <bits/stdc++.h> using namespace std; typedef long long ll; const in
阅读全文
牛客小白月赛98 A~D
摘要:牛客小白月赛98 A~D A-骰子魔术 签到不多说 // AC one more times // nndbk #include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9 + 7; c
阅读全文
牛客小白月赛99 C~E
摘要:牛客小白月赛99 C~E C-迷宫 思路:其实能不能到达,只要看起点和终点是否能变成连通的。射线技能只能用一次,我们在起点能到的点 去 是否在终点能到达的点的坐标中出现。 // AC one more times // nndbk #i
阅读全文
牛客小白月赛100 A~E
摘要:牛客小白月赛100 A~E A-ACM中的A题 签到不多说 // AC one more times // nndbk #include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9 +
阅读全文
算法竞赛个人模板
摘要:Math & DP & Data structure & Graph & Geometry & Game 表演者: magicat 💕 nannan 目录 Math & DP & Data structure & Graph & Geometry & GameHead快读1快读2快读3模板1模板2
阅读全文
2024 CCPC山东邀请赛 IAFKC
摘要:2024CCPC山东邀请赛 IAFKC I. Left Shifting 思路:要第一个和最后一个一样,那找到第一个连续的两个一样的就是答案。如果一开始第一个和最后一个就是一样的,那就是0。 // AC one more times // nndbk #include <bits/stdc++.h>
阅读全文
牛客小白月赛101 A~E
摘要:牛客小白月赛101 A~E A-tb的区间问题 题意:tb 给了 fc 一个长度为 n 的数组 A, fc 对 A 进行 k 次如下操作: 删除数组第一个元素或者删除数组最后一个元素。 求最后得到的数组和的最大值。 思路:最后删除的是某一组前后缀,一一去枚举可行的区间即可。 // AC one mo
阅读全文