摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll inf = 0x3f3f3f3f; const ll N = 5e5 + 9; struct edg 阅读全文
posted @ 2021-10-29 21:37 u_yan 阅读(39) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ld eps = 1e-8; const int N = 50009; const ld pi = aco 阅读全文
posted @ 2021-10-19 10:24 u_yan 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 计算时间 cout << "Totle Time : " << (double)clock() /CLOCKS_PER_SEC<< "s" << endl; 阅读全文
posted @ 2021-08-25 09:55 u_yan 阅读(17) 评论(0) 推荐(0) 编辑
摘要: P4051 [JSOI2007]字符加密 经典trick,很显然的是看到题目,就是后缀排序,然后如果你加一段原串到尾部,然后再进行后缀排序,会发现,\([1,n]\) 之间的后缀的相对位置关系没有发生变化,因为他们同时加上了相同的后缀,没有变化,所以直接排完序输出即可。 P2408 不同子串个数 首 阅读全文
posted @ 2021-08-24 10:28 u_yan 阅读(26) 评论(0) 推荐(0) 编辑
摘要: P3879 [TJOI2010]阅读理解 虽然不需要用trie,但是秉着练习需要,就强行加上trie,没想到其中收获了stl的应用熟练度。首先想的是用set来存取在哪一行,但是可是要求加上结尾不换行,那么在遍历的时候我有很喜欢写for (auto it:se[p]),显然如果我判断it == se[ 阅读全文
posted @ 2021-08-21 10:10 u_yan 阅读(40) 评论(0) 推荐(0) 编辑
摘要: kmp #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll N = 1e6 + 9; const ll inf = 0x3f3f3f3f; char a 阅读全文
posted @ 2021-08-20 10:59 u_yan 阅读(44) 评论(0) 推荐(0) 编辑
摘要: struct DI { ll n, m, S, T; ll h[N], ne[M], to[M], f[M], idx; void add(ll u, ll v, ll w) { ne[idx] = h[u], to[idx] = v, f[idx] = w, h[u] = idx++; ne[id 阅读全文
posted @ 2021-08-13 14:42 u_yan 阅读(42) 评论(0) 推荐(0) 编辑
摘要: ll fac[N], inv_fac[N]; ll q_pow(ll a, ll b, ll mod) { ll ret = 1; for (ll x = a; b; b >>= 1, (x*=x)%=mod){if (b&1)(ret *= x)%=mod;} return ret; } ll i 阅读全文
posted @ 2021-08-12 08:36 u_yan 阅读(42) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll N = 1e6 + 9; const ll inf = 0x3f3f3f3f; ll exgcd(l 阅读全文
posted @ 2021-08-11 11:16 u_yan 阅读(28) 评论(0) 推荐(0) 编辑
摘要: int pr[N], pr_cnt, flg[N], mu[N], sum_mu[N]; void init() { mu[1] = 1; for (int i = 2; i < N; i ++) { if (!flg[i])pr[++pr_cnt] = i, mu[i] = -1; for (in 阅读全文
posted @ 2021-08-09 10:54 u_yan 阅读(35) 评论(0) 推荐(0) 编辑