分治算法
RJ28
小学生
展开
-
Poj-1741 Tree(树的点分治)
DescriptionGive a tree with n vertices,each edge has a length(positive integer less than 1001).Define dist(u,v)=The min distance between node u and v. Give an integer k,for every pair (u,v)原创 2016-09-12 23:44:07 · 368 阅读 · 0 评论 -
Spoj - 1825 Free tour II(树的点分治)
题意:给一棵树,m个黑点和一个K,问最长的不超过k个黑点的带权路径。分析:树上的点分治,被卡了一天,因为宏定义出现了神奇的错误。#include#include#include#include#include#include#include#include#include#include#include#define INF 0x3f3f3f3f#d原创 2016-09-16 23:42:27 · 323 阅读 · 0 评论 -
Codeforces Round #372 (Div. 1) C. Digit Tree(树的点分治)
ZS the Coder has a large tree. It can be represented as an undirected connected graph ofn vertices numbered from 0 to n - 1 and n - 1 edges between them. There is a single nonzero digit writte原创 2016-09-18 01:21:21 · 688 阅读 · 0 评论 -
Hdu-5412 CRB and Queries(整体二分)
DescriptionThere are N boys in CodeLand. Boy i has his coding skill Ai. CRB wants to know who has the suitable coding skill. So you should treat the following two types of queries. Que原创 2016-10-07 21:54:16 · 314 阅读 · 0 评论 -
Codeforces Round #385 (Div. 1) B. Hongcow's Game(bitmask)
This is an interactive problem. In the interaction section below you will see the information about flushing the output.In this problem, you will be playing a game with Hongcow. How lucky of you!原创 2016-12-18 14:04:44 · 510 阅读 · 0 评论 -
Hdu-5016 Mart Master II(点分治+二分)
Trader Dogy lives in city S, which consists of n districts. There are n - 1 bidirectional roads in city S, each connects a pair of districts. Indeed, city S is connected, i.e. people can travel betwee原创 2017-10-18 09:46:58 · 337 阅读 · 0 评论 -
Hdu-5126 stars(cdq分治)
John loves to see the sky. A day has Q times. Each time John will find a new star in the sky, or he wants to know how many stars between(x1,y1,z1) and (x2,y2,z2). Input The first line co原创 2017-10-09 14:38:03 · 378 阅读 · 0 评论 -
Hdu-6183 Color it(cdq分治)
Do you like painting? Little D doesn't like painting, especially messy color paintings. Now Little B is painting. To prevent him from drawing messy painting, Little D asks you to write a program to ma原创 2017-10-31 17:59:36 · 291 阅读 · 0 评论