E - Water Distribution 题目大意: 有\(N\)座城市,给定这\(N\)座城市的坐标和初始的水量\(x_i,y_i,a_i\),在两个城市之间运水的花费是两个城市的欧几里得距离.最小水量的城市水量最大是多少. \(N\le 15\) 题目分析: 看数据够小,要么爆搜要么状压. 可以发现这和经典的TSP问题有些类似. 考虑通过构建联通分量来调节水,那么我们设联通分量的城市数量为\(K\),联通分量中的总水量为\(A\),联通分量中总的边长是\(B\),那么不难发现我们能够达到…
Atcoder CODE FESTIVAL 2016 Grand Final E - Water Distribution 题目链接:https://atcoder.jp/contests/cf16-exhibition-final/tasks/cf16_exhibition_final_e 洛谷链接:https://www.luogu.com.cn/problem/AT2230 模拟赛出了这道题,赛时觉得这题是最简单的一题,想了很久但是第一个结论就想错了,知道是状压但始终设不出来状态. Sol…
图基础 图(Graph)应用广泛,程序中可用邻接表和邻接矩阵表示图.依据不同维度,图可以分为有向图/无向图.有权图/无权图.连通图/非连通图.循环图/非循环图,有向图中的顶点具有入度/出度的概念. 面对图相关问题,第一步是将问题转为用图表示(邻接表/邻接矩阵),二是使用图相关算法求解. 相关LeetCode题: 997. Find the Town Judge  题解 1042. Flower Planting With No Adjacent  题解 图的遍历(DFS/BFS) 图的遍历/搜索…
http://blog.csdn.net/pipisorry/article/details/48579435 海量数据挖掘Mining Massive Datasets(MMDs) -Jure Leskovec courses学习笔记之链接分析:PageRank算法 链接分析与PageRank {大图分析the Analysis of Large Graphs} how the class fits together 图数据的例子 社交网络Social Networks(Facebook so…
Directions: For this part, you are allowed 30 minutes to write a short essay on the challenges of studying abroad. You should write at least 120 words but no more than 180 words. ①As is universally acknowledged, it is by no means easy to study abroad…
# Title Solution Acceptance Difficulty Frequency     4 Median of Two Sorted Arrays       27.2% Hard     10 Regular Expression Matching       25.6% Hard     23 Merge k Sorted Lists       35.8% Hard     25 Reverse Nodes in k-Group       37.7% Hard    …
题目来源 https://leetcode.com/problems/trapping-rain-water/ Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given [0,1,0,2,1,0,1,3,2,1,2,1…
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6. The above elevation map is represented by a…
题目来源: https://leetcode.com/problems/container-with-most-water/ 题意分析: 给出一个n长度的非0数组,a1,a2,……,an,ai代表在坐标i上的高度为ai.以以ai,aj为高,i到j为底,可以构造出一个容器.那么求出这些容器中可以装的水的最大容积(容器不能倾斜).例如数组[2,1],一共可以构造1个容器,这个容器的四个端点坐标是(0,0),(0,2),(1,1),(1,1),那么他可以装的最大的水容积是(1-0)*1 = 1. 题目…
题意 题目 思路 我一开始想的时候只考虑到一个结点周围的边界的情况,并没有考虑到边界的高度其实影响到所有的结点盛水的高度. 我们可以发现,中间是否能够盛水取决于边界是否足够高于里面的高度,所以这必然是一个从外到内,从小到大的一个过程.因为优先队列必然首先访问的是边界中最小的高度,如果周围小于这个高度那么必然是存在可以盛水的地方,就算是没有也没有任何的损失,只是更新了高度,但是队列依然会从高度小的结点开始访问: 实现 typedef struct node { int x, y; node(int…