摘要: 题目链接 思路: 每个节点额外维护的信息为,区间前缀最长01交替区间,区间后缀最长01交替区间,区间的最长01交替区间 由于单点修改,不需要维护懒标记 也就不需要pushdown操作 考虑pushup 当左儿子右端点的值和右儿子左端点的值不同时,显然可以连接起来 某个节点的最长前缀01区间:可以由左 阅读全文
posted @ 2025-06-10 19:44 Marinaco 阅读(16) 评论(0) 推荐(0)
摘要: int f[maxn]; int val[maxn]; int find(int x){ if(f[x]!=x){ int p=f[x]; f[x]=find(f[x]); val[x]+=val[p]; } return f[x]; } int merge(int x,int y,int c){ 阅读全文
posted @ 2025-06-10 19:01 Marinaco 阅读(12) 评论(0) 推荐(0)
摘要: A 略 B 用set模拟即可 int cal(int x,int y){ set<int>st; set<int>st2; while(x){ st.insert(x%10);x/=10; } while(y){ st2.insert(y%10);y/=10; } if(st==st2&&st.si 阅读全文
posted @ 2025-06-10 19:00 Marinaco 阅读(21) 评论(0) 推荐(0)
//雪花飘落效果