摘要: 模板拓扑(或许) #include<bits/stdc++.h> using namespace std; struct edge { int to,val,nxt; } e[10005]; struct answer { int id,val; } ans[105]; int h,m,n,t,u, 阅读全文
posted @ 2025-03-06 19:07 yzc_is_SadBee 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 由题解题意可知,就是求第二类斯特灵数 dp会吧……高精会吧…… #include<bits/stdc++.h> using namespace std; string add(string a,string b){ string ans; int na[1005]={0},nb[1005]={0}; 阅读全文
posted @ 2025-03-04 20:52 yzc_is_SadBee 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 最大生成树+lca。 参考资料 思路 首先便是想到了Floyd的暴力方法,状态转移方程也不难推出:w[i][j]=max(w[i][j], min(w[i][k],w[k][j]));但是n3次方时间复杂度和n2的空间复杂度是显然不可取的。 于是我们思考,可以发现有一些权值较小的边是不会被走过的。正 阅读全文
posted @ 2025-03-04 19:39 yzc_is_SadBee 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 早过了,但O2会爆 于是进行面向题解的编码 裸kruskal #include<bits/stdc++.h> using namespace std; struct node { int x,y,s; } d[200000]; int n,m,ans,num,f[1000],w,k,c; bool 阅读全文
posted @ 2025-03-04 18:50 yzc_is_SadBee 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 题目题解 but my code is outing #include<bits/stdc++.h> using namespace std; const int B=2e9; struct dot{ int x,y; }a[200010],ddt[200010]; inline int ass(i 阅读全文
posted @ 2025-02-27 20:30 yzc_is_SadBee 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 105,一眼nlogn。 考虑能不能写线段树(毕竟我只会这一种树状结构)。 发现很难想…… 看来得靠分治了 复习一手CDQ ??? 看了一眼题解 原来,我只是没想到前缀和,嘤嘤嘤 然后就成归并排序求逆序对了,只不过要加上0 然而90pts??? 不开ll见祖宗啊…… 简单放个代码 #include< 阅读全文
posted @ 2025-02-27 19:09 yzc_is_SadBee 阅读(4) 评论(0) 推荐(0) 编辑
摘要: luogu食用更佳 0.前言 如果你不知道怎么推式子,前面的人已经说的很清楚了,%%% 本题只要把式子推出来,一切都好说 因此,我只建议没听懂一长串balabala说怎么递推的蒟蒻比如我阅读这篇题解。 1.分析 先引用一下楼顶dalao的一段话: 首先可以发现每个 $x$ 都小于 $n$ ,而 $n 阅读全文
posted @ 2025-02-25 20:21 yzc_is_SadBee 阅读(4) 评论(0) 推荐(0) 编辑
摘要: oi-wiki说的够好了 这里提供方法二可处理有重数据的写法(当然很傻QAQ struct stu{ int v,id; bool operator < (const stu a)const{return v<a.v} }s[200010]; …… sort(s+1,s+n+1); //到这里差不多 阅读全文
posted @ 2025-02-20 20:39 yzc_is_SadBee 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 不知不觉,已经是博客园的牢用户了(回归了QAQ) oi-wiki是个好东西 Kruskal 思路 首先把动图扒下来 一目了然 将边排序,依次加边,看是否已经连接(有点像dij) 排序略,并查集维护集合 实现 //马上写 复杂度 O(m log m),适用于稀疏图 Prim 思路 其实oi-wiki已 阅读全文
posted @ 2024-12-07 13:45 yzc_is_SadBee 阅读(6) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; namespace IO { char buf[50]; } inline void qr(int &x){char ch=getchar(),lst=' ';while(ch>'9'||ch<'0')lst= 阅读全文
posted @ 2024-10-23 20:24 yzc_is_SadBee 阅读(9) 评论(0) 推荐(0) 编辑