
构造
Lynstery
一只蒟蒻
展开
-
[构造] 51Nod1385 凑数字
首先考虑 n=9999...999n=9999...999 这种情况,没法怎么节省,每位都有 1010 种可能,只能 98765432109876543210 重复位数次,总长度为 10∗len10*len 。 所以对于一个一般的长度为 lenlen 的 nn,至少需要10∗(len−1)10*(len-1)。 现在考虑最高位取非 00 的情况。注意到当最高位小于 nn 的最高位时,都需要加一个原创 2017-10-20 19:34:34 · 380 阅读 · 0 评论 -
[构造 分块] Codeforces #576C. Points on Plane
实际上就是个莫队的思想啊….. 哈夫曼距离就可以看作莫队时移动代价,然后就那样分块地排个序就好了。 过不了就稍微调一调块大小多试几次…#include<cstdio>#include<algorithm>using namespace std;const int maxn=1000005;int n,m,blk,_max;struct data{ int x,y,id;原创 2017-10-25 13:04:21 · 406 阅读 · 0 评论 -
[杂题 图论 构造] Codeforces #639B. Bear and Forgotten Tree 3
瞎搞题。 从 11 往下构造出两条长度分别为 d, h−dd,\ h-d 的链,然后剩下的点全部堆到某个点下面,注意当 d=hd=h 时特殊考虑一下。#include<cstdio>#include<algorithm>using namespace std;int n,H,D;int main(){ //freopen("cf639B.in","r",stdin); //原创 2017-11-06 16:01:38 · 366 阅读 · 0 评论