摘要: [ABC372D] Buildings 思路 正着做不方便,倒着用单调栈做一遍就行了。 代码 #include<iostream> using namespace std; inline int read(){register int x = 0, f = 1;register char c = g 阅读全文
posted @ 2024-10-12 16:55 bryce_yyds 阅读(35) 评论(0) 推荐(0)
摘要: 最大公约数 欧几里德算法 结论:\(\operatorname{gcd}(a, b)=\operatorname{gcd}(b, a \bmod b)\) 。 1.证明 \(\operatorname{gcd}(a, b)\mid\operatorname{gcd}(a\bmod b, b)\): 阅读全文
posted @ 2025-01-14 21:57 bryce_yyds 阅读(20) 评论(0) 推荐(0)
摘要: Day 0 在本校考,上午在刷板子,下午由于布置考场把我们都赶出去了,没事干只能和其他队友打篮球(没有进一个),晚上大概就是换了个小机房调整了一下就回家睡觉了,好像是 \(23:00\) 睡的。 Day1 早上 \(7:30\) 起的,感觉不是很清醒,遂骑车吹风来到学校。 到门口发现进不去,找到了几 阅读全文
posted @ 2024-12-26 16:09 bryce_yyds 阅读(26) 评论(0) 推荐(0)
摘要: T1 观察大样例,发现只有两个点被同样的集合包含这两个点一定不能成为单独的集合。 直接哈希,差分即可。 #include<iostream> #include<random> #include<map> #include<algorithm> using namespace std; inline 阅读全文
posted @ 2024-11-04 19:45 bryce_yyds 阅读(24) 评论(0) 推荐(0)
摘要: A - Pairing 思路 排个序,比较相邻元素。 代码 #include<iostream> #include<algorithm> using namespace std; inline int read(){register int x = 0, f = 1;register char c 阅读全文
posted @ 2024-11-04 09:44 bryce_yyds 阅读(17) 评论(0) 推荐(0)
摘要: dream 首先朴素的 \(dp\) 很好想,前缀和优化也很简单,接下来考虑如何继续优化。 我们发现反转操作相当于把一个序列变成环反转后再移动几格,于是我们只需要知道 \(1\) 位置的变换就能知道其它位置数的变换。 #include<iostream> #define int long long 阅读全文
posted @ 2024-11-01 21:44 bryce_yyds 阅读(13) 评论(0) 推荐(0)
摘要: T1 我们发现 \(1\) 其实根本没有用,只和一个连通块里的 \(0\) 的个数有关,直接 \(dfs\),判断即可。 #include<iostream> #include<cstring> using namespace std; inline int read(){register int 阅读全文
posted @ 2024-11-01 21:37 bryce_yyds 阅读(22) 评论(0) 推荐(0)
摘要: T1 状压 \(dp\),两两之间有相同的位,那一位就为 \(1\),否则就为 \(0\),考虑哪些选法不合法,要在 \(0\) 的位上为 \(1\),即只在 \(1\) 上选和不选都是不可以的,于是状压 \(dp\) 即可。 #include<iostream> #define int long 阅读全文
posted @ 2024-11-01 21:27 bryce_yyds 阅读(15) 评论(0) 推荐(0)
摘要: T1 考虑从后往前去做,随机化字母权值,考虑两个字符,一个设为正的权值,一个设为负的权值,两两就可以抵消,若有一个后缀权值等于另一个后缀权值且长度为偶数,就肯定有一个回文串,若有一个后缀权值等于另一个后缀权值加减一个字母的权值且长度为奇数,就也肯定有一个回文串,存下来,离散化即可。 #include 阅读全文
posted @ 2024-11-01 20:49 bryce_yyds 阅读(41) 评论(0) 推荐(0)
摘要: T1 建边,发现要找偶环,但两个奇环也可以拼在一起,于是按照上面的思路模拟即可。 但是挂了一个点,不知道为啥。 #include<iostream> #include<vector> #include<cstring> using namespace std; inline int read(){r 阅读全文
posted @ 2024-11-01 20:27 bryce_yyds 阅读(39) 评论(0) 推荐(0)
摘要: true 40pts 设 \(dp_{i, j, k}\) 表示第 \(i\) 个左端点为 \(j\),右端点为 \(k\) 的方案数,转移很好想,暴力枚举合法的 \(l, r\) 转移,由于空间开不下,选择用滚动数组优化一维,时间复杂度 \(O(nm^4)\)。 70pts 考虑在什么条件下才能够 阅读全文
posted @ 2024-10-15 21:37 bryce_yyds 阅读(13) 评论(0) 推荐(0)