二维树状数组模板
    
            
摘要:int Lowbit(int t){ return t&(-t);}void add(int x, int y){ int i=y; while(x<=n) { y=i; while(y<=n) { c[x][y]++; y+=Lowbit(y); } x+=Lowbit(x); }}int Sum(int x, int y){ int i=y, sum=0; while(x>0) { y=i; while...
        
阅读全文
                posted @ 
2012-08-09 07:50 
crying_Dream
        
阅读(618) 
         
        推荐(0)     
             
            
            
    POJ 2481 Cows【树状数组】
    
            
摘要:DescriptionFarmer John's cows have discovered that the clover growing along the ridge of the hill (which we can think of as a one-dimensional number line) in his field is particularly good.Farmer John has N cows (we number the cows from 1 to N). Each of Farmer John's N cows has a range of cl
        
阅读全文
                posted @ 
2012-08-08 21:14 
crying_Dream
        
阅读(418) 
         
        推荐(0)     
             
            
            
    POJ 2352 Stars【树状数组】
    
            
摘要:DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and not to the right of the given star. Astronomers want to know the distribution of the leve
        
阅读全文
                posted @ 
2012-08-08 15:47 
crying_Dream
        
阅读(1433) 
         
        推荐(0)     
             
            
            
    树状数组模板
    
            
摘要:int c[N], n; int Lowbit(int t) //求某一点的管辖范围{ return t&(t^(t-1)); //也可以写成 return t&(-t);}int Sum(int end) //求区间和{ int sum = 0; while(end > 0) { sum += c[end]; end -= Lowbit(end); } return sum;}void add(int li, int val) //开始构建一个树状数组, 也可以修改数组{ while(li<=n) { ...
        
阅读全文
                posted @ 
2012-08-08 15:36 
crying_Dream
        
阅读(311) 
         
        推荐(0)     
             
            
            
    POJ 2236 Wireless Network【裸并查集+计算几何】
    
            
摘要:DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the network were all broken. The computers are repaired one by one, and the network gradually 
        
阅读全文
                posted @ 
2012-08-07 13:46 
crying_Dream
        
阅读(220) 
         
        推荐(0)     
             
            
            
    POJ 1308  Is It A Tree?【裸的并查集】
    
            
摘要:Language:DescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties.There is exactly one node, called the root, to which no directed edges point.Every node 
        
阅读全文
                posted @ 
2012-08-07 13:42 
crying_Dream
        
阅读(188) 
         
        推荐(0)     
             
            
            
    POJ 1182 食物链【带种类并查集】
    
            
摘要:Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y",表示X吃Y。 此人对N个动物,用上述两种说法,一句接一句地说出K句话,这K句话有的是真的,有的是假的。当一句话满足下列三条之一时,这句话就是假话,否则就是真话。 1) 当前的话与前面的某些真的话冲突,就是假话; 2)
        
阅读全文
                posted @ 
2012-08-05 11:23 
crying_Dream
        
阅读(228) 
         
        推荐(0)     
             
            
            
    POJ 1703 Find them, Catch them【带种类的并查集】
    
            
摘要:DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to identify which gang a criminal belongs to. The present question is, given two criminals; do they belong t
        
阅读全文
                posted @ 
2012-08-04 21:51 
crying_Dream
        
阅读(417) 
         
        推荐(0)     
             
            
            
    POJ 1035 Spell checker【字符串处理】
    
            
摘要:DescriptionYou, as a member of a development team for a new spell checking program, are to write a module that will check the correctness of given words using a known dictionary of all correct words in all their forms.If the word is absent in the dictionary then it can be replaced by correct words (
        
阅读全文
                posted @ 
2012-08-03 23:44 
crying_Dream
        
阅读(297) 
         
        推荐(0)