摘要: 阅读全文
posted @ 2021-08-19 19:05 latent_Lin 阅读(41) 评论(1) 推荐(0)
摘要: 传送门 感想:奇奇怪怪的STL和奇奇怪怪的折半 #include<iostream> #include<cstdio> #include<cmath> #include<map> #include<queue> #include<algorithm> #include<cstring> #inclu 阅读全文
posted @ 2021-08-19 11:13 latent_Lin 阅读(25) 评论(0) 推荐(0)
摘要: 某位神犇整理的 阅读全文
posted @ 2021-08-19 09:31 latent_Lin 阅读(18) 评论(0) 推荐(0)
摘要: 将一个数 a 拆成若干数相加,使得这若干个数的 LCM 最大。 a ≤ 30000 首先,拆成质数是最优的 我实在没想到这题居然是DP 如果知道这题是用DP就好办了 传送门 阅读全文
posted @ 2021-08-18 22:12 latent_Lin 阅读(23) 评论(0) 推荐(0)
摘要: 注:π(x):1~x的素数个数 当x足够大,趋近于x/ln(x) 阅读全文
posted @ 2021-08-18 22:00 latent_Lin 阅读(28) 评论(0) 推荐(0)
摘要: 题目传送门 题目大意就是给定一棵 n 个点的树,m 次询问,每次询问给出三个点,问应该选 择哪个点,使得三点到该点的距离和最小。 容易发现,集合点一定在两两点的路径上,三者 LCA 中的一个。 其最短路径即为俩俩点距离和的一半 时间复杂度为 O(m log n) 没打代码,嘿嘿 阅读全文
posted @ 2021-08-18 15:05 latent_Lin 阅读(30) 评论(0) 推荐(0)
摘要: 例题 网上查多叉转二叉好处就是好实现(好打代码)?! #include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int dp[1001][1001],c[1001][1001] 阅读全文
posted @ 2021-08-17 22:31 latent_Lin 阅读(49) 评论(0) 推荐(0)
摘要: 传送门 特别有意思的一道题 用了“分块”思想 没打代码,嘿嘿 阅读全文
posted @ 2021-08-17 22:27 latent_Lin 阅读(10) 评论(0) 推荐(0)
摘要: T4 逆向,考虑增加一条边,将两个连通块合并了 考虑新连通块的直径与原来两个连通块直径的关系 设新连通块的直径端点为 x, y,原两个连通块的直径端点为a, b, c, d。 容易发现,x, y 一定是 a, b, c, d 其中之一。 除去原先两个连通块直径长度,乘上新连通块直径长度(除法需乘法逆 阅读全文
posted @ 2021-08-16 21:42 latent_Lin 阅读(37) 评论(0) 推荐(0)
摘要: 当n∈【30,40】可以考虑下 复杂度大概是O(2^(n/2)) 算半个模板题吧 某位机房大佬(折半+STL) #include<bits/stdc++.h> using namespace std; long long n,m,w[101],mid,a[1<<20],b[1<<20],sum1,s 阅读全文
posted @ 2021-08-13 21:26 latent_Lin 阅读(44) 评论(0) 推荐(0)