- 博客(3)
- 收藏
- 关注
原创 LCA两种在线解法(RMQ+欧拉序、树上倍增)模板
LCA(最近公共祖先)的树上倍增解法模板,附有详细代码注释 我们知道,最近公共祖先是指有根树上找出任意两个节点,u,v的最近的公共祖先。 解释都在代码里: #pragma GCC optimize(2) #include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0) #define ull unsigned ll #define uint unsigned #define pai pair<i
2020-08-10 14:47:38
1725
1
原创 静态(非带修)主席树模板(可持久化权值线段树)
静态(非带修)主席树模板(可持久化权值线段树) 洛谷上的主席树模板题 写完后可以自己去交一下,数据已经优化过,必须用主席树写。 接下来是我自己的模板 #include<bits/stdc++.h> using namespace std; const int N=2e5+5; int w[N],s[N],rk[N],root[N]; int n,m,size,cnt=0; struct President_tree { int ls,rs,sum; }t[N*20]; void b
2020-08-03 20:08:22
256
原创 AtCoder Beginner Contest 174 C Repsept
Repsept 题目: Takahashi loves the number 7 and multiples of K.Where is the first occurrence of a multiple of K in the sequence 7,77,777,…? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print -1 instead. Input In
2020-08-03 16:32:13
1200
4
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅