随笔分类 - 数据结构
摘要:int MinimumRepresentation(int *s, int l) { int i,j,k; i=0;j=1;k=0; while(is[j+k]) if(i+k+1>j) i=i+k+1; else i=j+1; else if(j+k+1>i) j=j+k+1; ...
阅读全文
摘要:Police headquarter is monitoring signal on different frequency levels. They have got two suspiciously encoded strings s1 and s2 from two different fre
阅读全文
摘要:Imagine A is a NxM matrix with two basic properties 1) Each element in the matrix is distinct and lies in the range of 1<=A[i][j]<=(N*M) 2) For any tw
阅读全文
摘要:我感觉二维树状数组和而为线段树的思想差不多,都是在原来的基础上加了一个新的树状数组或者是线段树,代码量也不是那么的大。 然后我想找一个图的,但是在百度上面也没有找到什么好点的图,因为一维树状数组解决的是一个区间的和,那么我们每个数下面再加上一个树状数组, 那么我们解决的就是一个矩形区域的所有的数的和
阅读全文
摘要:Problem Description There are n men ,every man has an ID(1..n).their ID is unique. Whose ID is i and i-1 are friends, Whose ID is i and i+1 are friend
阅读全文