因为之前忘做了,赶紧补上。 T1.Promotion Counting 题目大意:给定一个以1为根的N个节点的树(N<=100,000),每个节点有一个权值,对于每个节点求出权值比它大的子孙的个数。 思路:肯定先要求出dfs序,首先无脑想到主席树,后来发现只要按权值从大到小处理就不用那么麻烦了。 T ...
分类:
其他好文 时间:
2017-02-16 11:31:21
阅读次数:
357
On the number axis, there are N lines. The two endpoints L and R of each line are integer. Give you M queries, each query contains two intervals: [L1, ...
分类:
编程语言 时间:
2017-02-11 11:23:45
阅读次数:
215
转载请注明出处:http://www.cnblogs.com/liangyongrui/p/6350267.html 我用了一个很蹩脚的做法做出来了。 虽然也是O(n) 但是看了标算后,感觉自己的dp实在是不够敏感 我的做法就是堆基底(1 2 4 8 16 32...) 但是用了dp的思想后,都是三 ...
分类:
其他好文 时间:
2017-01-26 00:15:56
阅读次数:
194
Hello Kiki Problem Description One day I was shopping in the supermarket. There was a cashier counting coins seriously when a little kid running and s ...
分类:
其他好文 时间:
2017-01-20 22:20:24
阅读次数:
328
解决的办法:在Build Settings >Aplle LLVM8.0 - Language - Objectibe-C >Weak Reference In Manual Retain Release 设置为YES。 ...
分类:
移动开发 时间:
2017-01-20 12:39:01
阅读次数:
199
http://poj.org/problem?id=1979 方法和Lake Counting 完全一样 ...
分类:
其他好文 时间:
2017-01-17 00:45:46
阅读次数:
201
规律:i等于二的N次幂时,Hamming weight为 1.HammingWeight(2) = 1HammingWeight(3) = HammingWeight(2) + HammingWeight(1) = 2......HammingWeight(8) = 1HammingWeight(9... ...
分类:
其他好文 时间:
2017-01-16 22:30:36
阅读次数:
198
https://hacks.mozilla.org/2015/04/es6-in-depth-an-introduction/ Counting to 6 The previous editions of the ECMAScript standard were numbered 1, 2, 3, ...
分类:
Web程序 时间:
2017-01-06 13:57:37
阅读次数:
199
Counting Sort 计数排序 计数排序其实就是利用了数组可以O(1)时间访问元素的特性,来排序,可是如果数据范围很大时是很浪费空间的。 伪代码: 通过数组来判断大小,和在序列中所在的位置,从而进行排序。 代码如下: ...
分类:
编程语言 时间:
2016-12-28 12:18:36
阅读次数:
157
2.1 最基础的穷竭搜索 poj 2386 Lake Counting(裸dfs) 题意:n*m的矩阵 W是水 .是地 问有多少池塘。(池塘的定义是: W通过八个方向连接成的一片算作是一个池塘。) 1 #include <iostream> 2 using namespace std; 3 #inc ...
分类:
其他好文 时间:
2016-12-27 09:57:25
阅读次数:
266