• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Codjjj
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理
1 2 3 4 5 下一页

2023年3月25日

启发式合并板子(梦幻布丁)
摘要: Link 启发式合并是针对n个集合(总元素个数是O(n))的合并操作,每次将小的集合合并到大的集合 复杂度证明: 考虑每一个元素$$e \in E$$的贡献,如果在某一次合并中该元素被移动,那么集合的大小至少是$$2|E|$$,故复杂度是$$O(nlogn)$$ 具体的题目而言,我们可以看出对于$$ 阅读全文
posted @ 2023-03-25 16:26 _Codjjj 阅读(47) 评论(0) 推荐(0)
 
 

2023年3月20日

欧拉序+ST表 O(nlogn+q)求LCA
摘要: 欧拉序:每次遍历到树上的一个点,就加进欧拉序 如 1 2 3 ​ 4 5 这颗树的欧拉序是121343431 这样我们可以发现一个重要的性质:两个点的LCA是欧拉序之间dep最小的点 易发现这是对的,因为LCA肯定会在欧拉序之间,而LCA的祖先不会,因为如果会,说明LCA的这颗子树已经被遍历完了,那 阅读全文
posted @ 2023-03-20 20:48 _Codjjj 阅读(201) 评论(0) 推荐(0)
 
 

2022年4月20日

XIX Open Cup Onsite: E - Power of Function (数位+思维)
摘要: 观察到:我们可以从高位到第低位枚举第一个l和r不同的位置,记为diff,那么使得m取得最大的n有两种情况:要么n=r,要么n!=r,如果n!=r,那么要使得m最大,只有在 \[ diff<=x<最大的位数 \] 时,在[0,x-1]位上,n与r相同,x位上n=mr[x]-1,[x+1,最大位数]上全 阅读全文
posted @ 2022-04-20 21:52 _Codjjj 阅读(71) 评论(0) 推荐(0)
 
 

2022年3月24日

D. Lexicographically Minimal Shortest Path题解([2020, XIII Samara Regional Intercollegiate Programming Contest](https://codeforces.com/gym/102569))
摘要: Link 如何处理起点和终点呢? 先从终点搜,维护每个点到终点的距离 再从起点搜,每次从当前点,先选能到终点更近一步的边,再从这些边中,选出字母最小的所有边,加进集合中,直至搜到终点,就是字典序最小的最短路 #include <bits/stdc++.h> using namespace std; 阅读全文
posted @ 2022-03-24 11:06 _Codjjj 阅读(112) 评论(0) 推荐(0)
 
 

2022年3月18日

Gym 102700A.Approach(三分板子)
摘要: Link #include <bits/stdc++.h> using namespace std; double x1,x2,yy1,y2; double x3,x4,y3,y4; double angle1,angle2,d1,d2; double get_dist(double a,doubl 阅读全文
posted @ 2022-03-18 09:25 _Codjjj 阅读(43) 评论(0) 推荐(0)
 
 

2022年3月5日

树链剖分笔记
摘要: 1.将一棵树转化成一个序列 2.树中路径转化成logn段连续区间 重儿子 重边 重链:对于轻儿子,重链自它起始 重儿子在它父节点的重链上 dfs中优先遍历重儿子 ,保证重链上所有点的编号是连续的 **定理:**树中任意一条路径均可拆分成O(logn)个重链(即为logn个连续区间) #include 阅读全文
posted @ 2022-03-05 09:42 _Codjjj 阅读(31) 评论(0) 推荐(0)
 
 

2022年2月26日

021-2022-INES A. Armor and Weapons Solution(玄学剪枝,限界)
摘要: LINK #include<bits/stdc++.h> #include <unordered_set> #define int long long using namespace std; typedef pair<int, int> PII; typedef pair<PII, int> PI 阅读全文
posted @ 2022-02-26 09:45 _Codjjj 阅读(50) 评论(0) 推荐(0)
 
 

2022年2月25日

CF600E Lomsat gelral(树上启发式合并)
摘要: LINK Code: #include <iostream> #include <cstring> #include <algorithm> #define int long long typedef long long LL; using namespace std; const int N = 阅读全文
posted @ 2022-02-25 09:49 _Codjjj 阅读(40) 评论(1) 推荐(0)
 
 

2022年2月23日

序列哈希+集合划分
摘要: Link #include <iostream> #include <cstring> #include <algorithm> #include <cmath> #include <vector> #define int long long #define x first #define y se 阅读全文
posted @ 2022-02-23 23:17 _Codjjj 阅读(79) 评论(0) 推荐(0)
 
 

2022年2月21日

高斯消元板子题
摘要: Problem Link #include <bits/stdc++.h> using namespace std; const int N = 15; double b[N][N],a[N][N]; int n; void guass(){ for(int r=1,c=1;c<=n;c++,r++ 阅读全文
posted @ 2022-02-21 22:22 _Codjjj 阅读(36) 评论(0) 推荐(0)
 
 
1 2 3 4 5 下一页

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3