随笔分类 -  题解

摘要:代码 阅读全文
posted @ 2020-02-22 18:27 leiyuanze 阅读(114) 评论(0) 推荐(0)
摘要:代码 #include<cstdio> using namespace std; const int N = 1e5; double fx[N + 5] , fy[N + 5] , g[N + 5]; int x , y; inline void getp(int n , double f[] , 阅读全文
posted @ 2020-02-22 18:25 leiyuanze 阅读(102) 评论(0) 推荐(0)
摘要:题目大意 构造一个分段函数来拟合若干点($x_i , y_i$),每一段是一个常函数,即 $$ f(x)= \left \{ \begin{aligned} a_1& & (0\leq x include using namespace std; const int N = 1e6; int n , 阅读全文
posted @ 2020-02-22 18:23 leiyuanze 阅读(215) 评论(0) 推荐(0)
摘要:```cpp #include using namespace std; typedef long long LL; LL n , k , p = 1e9 + 7; inline LL fpow(LL x , LL y) { LL res = 1; while (y) { if (y & 1) res = res * x % p; x = x * x % p , y >>= 1; } return 阅读全文
posted @ 2020-02-20 19:38 leiyuanze 阅读(178) 评论(0) 推荐(0)
摘要:```cpp #include #include using namespace std; const int M = 10000; const double inf = 1e18; int n , m , h[505] , cur[505] , dep[505] , s , t , tot = 1; double a[55] , b[55] , ans , Max; struct edge{ i 阅读全文
posted @ 2020-02-20 19:37 leiyuanze 阅读(118) 评论(0) 推荐(0)
摘要:代码 (树链剖分) 阅读全文
posted @ 2020-02-20 19:34 leiyuanze 阅读(171) 评论(0) 推荐(0)
摘要:```cpp #include #include using namespace std; typedef long long LL; const int N = 1 = 4) return; c[++tot] = i , c[++tot] = i + 1; } if (!tot) return; for(register int i = 1; i <= tot; i++) for(registe 阅读全文
posted @ 2020-02-20 19:33 leiyuanze 阅读(156) 评论(0) 推荐(0)
摘要:```cpp #include #include using namespace std; const int N = 210 , M = 210000 , INF = 2147483647; int a[N + 5][N + 5] , b[N + 5][N + 5] , n , m , s , t , ans; char str[N + 5]; int dep[N * N + 5] , cur[ 阅读全文
posted @ 2020-02-20 19:32 leiyuanze 阅读(178) 评论(0) 推荐(0)
摘要:```cpp #include #include #include #include using namespace std; typedef long long LL; const int N = 1e5; int n , lim , x[N + 5] , y[N + 5] , z[N + 5] , sum; int bl[(N '9'; ch = getchar()); for(; ch >= 阅读全文
posted @ 2020-02-20 19:26 leiyuanze 阅读(89) 评论(0) 推荐(0)
摘要:#pragma GCC optimize(2) #pragma GCC optimize(3) #include<cstdio> using namespace std; const int N = 30000; const double INF = 1e8; int n , l , a[N + 5 阅读全文
posted @ 2020-02-20 19:24 leiyuanze 阅读(141) 评论(0) 推荐(0)
摘要:```cpp #include #include using namespace std; typedef long long LL; const int N = 1e6; LL x , a , b , c , m , f[N + 10] , p; int n , len , vis[N + 10]; inline LL fpow(LL x , int y , LL p) { LL res = 1 阅读全文
posted @ 2020-02-20 19:22 leiyuanze 阅读(110) 评论(0) 推荐(0)
摘要:代码 阅读全文
posted @ 2020-02-20 19:20 leiyuanze 阅读(98) 评论(0) 推荐(0)
摘要:代码 阅读全文
posted @ 2020-02-20 19:18 leiyuanze 阅读(179) 评论(0) 推荐(0)
摘要:代码 阅读全文
posted @ 2020-02-20 19:15 leiyuanze 阅读(849) 评论(0) 推荐(0)
摘要:代码 阅读全文
posted @ 2020-02-20 19:12 leiyuanze 阅读(162) 评论(0) 推荐(0)
摘要:代码 #include<cstdio> #include<algorithm> using namespace std; const int N = 200000; int f[N + 5] , g[N + 5] , h[N + 5] , son[N + 5] , res[N + 5] , Maxl 阅读全文
posted @ 2020-02-16 22:28 leiyuanze 阅读(220) 评论(0) 推荐(0)
摘要:$Description$ 某一天,少年邂逅了同病相连的IA。见面后,IA一把牵起少年的手,决定和他一起逃离部落,离开这个无法容身的是非之地。 要逃离部落,少年和IA就需要先选择一条耗时最少的路线,从而避免被部落的大人们抓到。部落可以大致分为N个区域,少年和IA在区域1,部落的出口设在区域N。此外部 阅读全文
posted @ 2020-02-16 22:26 leiyuanze 阅读(630) 评论(0) 推荐(0)
摘要:[SDOI2015]约数个数和 闲话:莫比乌斯反演经典题 题目大意 求 $$ \sum_{i=1}^n \sum_{j=1}^m \sigma_0 (ij) $$ $T$ 组数据,且 $1 \leq T,n,m \leq 50000$ 良心样例 输入样例 2 7 4 5 6 输出样例 110 121 阅读全文
posted @ 2020-02-15 18:01 leiyuanze 阅读(309) 评论(0) 推荐(0)
摘要:本章学习斜率优化建图 请放心食用 引言 最小生成树($mst$) ($Algorithm: \text {Prim or Kruskal}$) 从裸题到一丁点技巧,再到丧心病狂的神仙题 原始时间复杂度 $O(N^2)$ 与 $O(M log M)$ 永远的 $TLE$ ······ 正话 本文第一句 阅读全文
posted @ 2020-02-12 16:07 leiyuanze 阅读(316) 评论(0) 推荐(0)
摘要:在 \(DP\) 的世界里 有一种题需要单调队列优化 \(DP\) 一般在此时,\(f_i\) 和它的决策集合 \(f_j\) 在转移时 \(i\) 不和 \(j\) 粘在一起(即所有的 \(j\) 转移到 $i$时 关于$j$ 的部分全都与 $i$无关), 果真如此,我们就可以用单调队列优化,留下 阅读全文
posted @ 2020-02-06 16:40 leiyuanze 阅读(297) 评论(1) 推荐(1)