摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N=1e5+10; vector<ll> G[N],ans; ll n,m,du[N],cur[N],s=1; void dfs(ll u){ fo 阅读全文
posted @ 2024-01-24 16:35 Alric 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 求割点 #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N=2e4+10; ll n,m,dfn[N],low[N],tot,root; bool cut[N]; vector<ll> G[N]; 阅读全文
posted @ 2024-01-24 13:28 Alric 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 求欧拉函数 ll calphi(ll x){ ll ret=x; for(ll i=2;i<=x/i;i++){ if(x%i==0){ ret=ret/i*(i-1); while(x%i==0)x/=i; } } if(x>1)ret=ret/x*(x-1); return ret; } 求莫比 阅读全文
posted @ 2024-01-07 17:14 Alric 阅读(2) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N=1e7+10; struct node{ll ls,rs,fa,pri;}t[N]; ll n; int main(){ ios::sync_w 阅读全文
posted @ 2024-01-06 22:36 Alric 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 普通平衡树 #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N=1e5+10; ll root,tot; struct node{ll ls,rs,val,pri,sz;}t[N]; void p 阅读全文
posted @ 2024-01-06 14:44 Alric 阅读(2) 评论(0) 推荐(0) 编辑
摘要: son[x]表示节点\(x\)的重儿子,若为\(0\),则说明\(x\)为叶子节点 id[x]表示节点\(x\)的dfs序编号 f[x]表示节点\(x\)的父节点 dep[x]表示节点\(x\)的深度 sz[x]表示节点为\(x\)的子树的大小 top[x]表示x所在重链顶部的节点 函数原型void 阅读全文
posted @ 2024-01-05 16:54 Alric 阅读(5) 评论(0) 推荐(0) 编辑
摘要: \(x\)为整数时: 如果\(x>\frac{a}{b}\),那么\(x\ge\lfloor\frac{a}{b}\rfloor+1\) 如果\(x<\frac{a}{b}\),那么\(x\le\lceil\frac{a}{b}\rceil-1\) 如果\(x\ge\frac{a}{b}\),那么\ 阅读全文
posted @ 2024-01-01 16:39 Alric 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 题目大意: 每次操作可以把\(v\)变成\((v+1)\mod 32768\)或\((2\times v)\mod 32768\),求\(v\)变成\(0\)最少需要操作几次。 \(v\)等于\(0\)时答案为\(0\),我们将\(0\)标记,然后让\(0\)入队。 然后不断进行以下操作,直到队列为 阅读全文
posted @ 2023-12-19 15:23 Alric 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 题目大意: 判断一个数组是否满足其中任意三个元素之和均为数组的元素 如果一个元素出现的次数大于三,那么我们将这个元素的数量减到三,答案不会变。 另外,我们发现,如果数组至少中有三个正数,或者至少有三个负数,那么答案一定为NO。 如果上面的条件不满足,那么现在这个数组里的元素最多只有7个(2个正数,2 阅读全文
posted @ 2023-12-17 18:55 Alric 阅读(10) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> G[500000+10]; ll n,m,root; ll f[500000+10][20],dep[500000+10],lg[500000+ 阅读全文
posted @ 2023-11-27 21:57 Alric 阅读(2) 评论(0) 推荐(0) 编辑