摘要: 注意维护两列 , 但是并不需要反复粘贴行 , 利用cur ^=1来复用 代码 #include<bits/stdc++.h> using namespace std; inline int read() { int ans = 0, f = 1; char ch = getchar(); while 阅读全文
posted @ 2025-06-01 14:29 Guaninf 阅读(10) 评论(0) 推荐(0)
摘要: 题意 LCA板子 代码 #include<bits/stdc++.h> using namespace std; inline int read() { int ans = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { i 阅读全文
posted @ 2025-06-01 14:16 Guaninf 阅读(5) 评论(0) 推荐(0)
摘要: 洛谷 P3379 倍增算法 \(dep_u\) 求u的深度 , 最低为1 \(fa_{u,i}\)为u向上跳\(2^i\)层的祖先结点 , i = 0,1,2,3... 代码 #include<bits/stdc++.h> using namespace std; #define int long 阅读全文
posted @ 2025-06-01 14:15 Guaninf 阅读(8) 评论(0) 推荐(0)
摘要: 题意 如果我们之间的距离是一千步,我会向你走出九百九十九步,只要你向我的方向迈出最后的一步。后来,我朝你的方向走了一千步,我却不知道你在哪里。 (写题写出了网抑云...) 给定\(n,m\)个点 , 分别代表两个折线段 , 求其中折线段相距最近的距离 思路 第一次做计算几何的题 点到线段的距离 利用 阅读全文
posted @ 2025-06-01 13:33 Guaninf 阅读(16) 评论(0) 推荐(0)
摘要: 代码 #include<bits/stdc++.h> using namespace std; #define int long long int inline int read() { int ans = 0, f = 1; char ch = getchar(); while (ch < '0' 阅读全文
posted @ 2025-06-01 12:32 Guaninf 阅读(4) 评论(0) 推荐(0)
摘要: 代码 #include<bits/stdc++.h> using namespace std; inline int read() { int ans = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == 阅读全文
posted @ 2025-06-01 11:33 Guaninf 阅读(30) 评论(0) 推荐(0)
摘要: 题意 给定长为\(n\)的字符串 , 每个字母都有\(val\)值 , 计算其所有子串的总价值 当字串价值和模\(k\)为区间长度时 , 产生价值\(m\) 思路 典型的数组求值问题 , 这种问题一般想双指针 , 预处理 , 枚举贡献 , 枚举左右端点 , 但是都没有什么思路 考虑模数这个特点 , 阅读全文
posted @ 2025-06-01 11:32 Guaninf 阅读(13) 评论(0) 推荐(0)
摘要: 题意 给定集合\(D\) , 含有\(n\)个元素 , \(f\)是\(D\)上函数 , 值域为\(D\) , \(F\)的定义域为\(D\times D\) 求对任意x , 存在y使得\(F(x,f(y))\)在给定赋值下的真值 思路 实际上本题是一个阅读理解 由于f定义域和值域都为\(D\) , 阅读全文
posted @ 2025-06-01 10:12 Guaninf 阅读(5) 评论(0) 推荐(0)
摘要: 题意 给定\(n\)个数 , 判断是否是某个数\(x\)的所有因数 思路 如果是的话 , 那么其中每个因数的因数都该在这\(n\)个数字中 , 且每个数字只出现一次 在是的情况下 , 最小数乘最大数就是\(x\) 代码 #include<bits/stdc++.h> using namespace 阅读全文
posted @ 2025-06-01 09:55 Guaninf 阅读(8) 评论(0) 推荐(0)
摘要: 代码 #include <iostream> using namespace std; int mp[100005]; int main() { int n; cin>>n; int tmp; for(int i = 1; i<= n; i++) { cin>>tmp; mp[tmp]++; } i 阅读全文
posted @ 2025-06-01 02:31 Guaninf 阅读(8) 评论(0) 推荐(0)
摘要: 题意 代码 #include<bits/stdc++.h> using namespace std; inline int read() { int ans = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch 阅读全文
posted @ 2025-06-01 00:40 Guaninf 阅读(6) 评论(0) 推荐(0)