锘??xml version="1.0" encoding="utf-8" standalone="yes"?>韩国三级中文字幕hd久久精品 ,久久亚洲高清综合,91精品婷婷国产综合久久http://www.shnenglu.com/vontroy/category/14337.htmlzh-cnSun, 20 Jan 2013 06:37:35 GMTSun, 20 Jan 2013 06:37:35 GMT60POJ 3468 A Simple Problem with Integershttp://www.shnenglu.com/vontroy/archive/2010/07/29/121523.htmlVontroyVontroyWed, 28 Jul 2010 23:16:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/07/29/121523.htmlhttp://www.shnenglu.com/vontroy/comments/121523.htmlhttp://www.shnenglu.com/vontroy/archive/2010/07/29/121523.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/121523.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/121523.html#include <iostream>
#include 
<cstdio>

using namespace std;

struct CNode
{
    
int L, R;
    CNode 
* pLeft, * pRight;
    
long long nSum, Inc;
};

CNode Tree[
1000000];

int nCount = 0;

void BuildTree( CNode * pRoot, int L, int R )
{
    pRoot
->= L;
    pRoot
->= R;
    pRoot
->nSum = 0;
    pRoot
->Inc = 0;

    
if( L == R )    return;
    nCount
++;
    pRoot
->pLeft = Tree + nCount;
    nCount
++;
    pRoot
->pRight = Tree + nCount;
    BuildTree( pRoot
->pLeft, L, ( L + R ) / 2 );
    BuildTree( pRoot
->pRight, ( L + R ) / 2 + 1, R );
}

void Insert( CNode * pRoot, int i, int v )
{
    
if( pRoot->== i && pRoot->== i )
    {
        pRoot
->nSum = v;
        
return;
    }
    pRoot
->nSum += v;
    
if( i <= ( pRoot->+ pRoot->R ) / 2 )
        Insert( pRoot
->pLeft, i, v );
    
else
        Insert( pRoot
->pRight, i, v);
}

void Add( CNode * pRoot, int a, int b, long long c )
{
    
if( a == pRoot->&& b == pRoot->R )
    {
        pRoot
->Inc += c;
        
return;
    }
    pRoot
->nSum += ( b - a + 1 ) * c;
    
if( b <= ( pRoot->+ pRoot->R ) / 2)
        Add( pRoot
->pLeft, a, b, c );
    
else if ( a >= (pRoot->+ pRoot->R ) / 2 + 1 )
        Add ( pRoot
->pRight, a, b, c );
    
else
    {
        Add( pRoot
->pLeft, a, ( pRoot->+ pRoot->R ) / 2, c );
        Add( pRoot
->pRight, (pRoot->+ pRoot->R ) / 2 + 1, b, c );
    }
}

long long QuerynSum( CNode * pRoot, int a, int b )
{
    
if ( a == pRoot->&& b == pRoot->R )
        
return (pRoot->nSum + (pRoot->- pRoot->+ 1 ) * pRoot->Inc);
    pRoot
->nSum += (pRoot->- pRoot->+ 1 ) * pRoot->Inc;
    Add( pRoot
->pLeft, pRoot->L, (pRoot->+ pRoot->R ) / 2, pRoot->Inc );
    Add( pRoot
->pRight, (pRoot->+ pRoot->R ) / 2 + 1, pRoot->R, pRoot->Inc );
    pRoot
->Inc = 0;

    
if( b <= (pRoot->+ pRoot->R ) /2 )
        
return QuerynSum( pRoot->pLeft, a, b );
    
else if ( a >= (pRoot->+ pRoot->R ) / 2 + 1 )
        
return QuerynSum ( pRoot->pRight, a, b);
    
else
        
return QuerynSum( pRoot->pLeft, a, (pRoot->L  +pRoot->R ) / 2 ) + QuerynSum( pRoot->pRight, (pRoot->+ pRoot->R ) / 2 + 1, b ) ;
}

int main()
{
    
int n,q;
    scanf(
"%d%d"&n, &q );
    nCount 
= 0;
    BuildTree( Tree, 
1, n);
    
int temp;
    
forint i = 1; i <= n; i++ )
    {
        scanf(
"%d"&temp);
        Insert( Tree, i, temp );
    }
    
char c_temp[10];
    
int a, b, c;
    
forint i = 0; i < q; i++ )
    {
        scanf(
"%s", c_temp);
        
if( c_temp[0== 'C' )
        {
            scanf(
"%d%d%d"&a, &b, &c );
            Add( Tree, a, b, c);
        }
        
else
        {
            scanf(
"%d%d"&a, &b );
            printf(
"%I64d\n",QuerynSum( Tree, a, b ));
        }
    }
    
return 0;
}


Vontroy 2010-07-29 07:16 鍙戣〃璇勮
]]>
POJ 3264 Balanced Lineup http://www.shnenglu.com/vontroy/archive/2010/07/29/121522.htmlVontroyVontroyWed, 28 Jul 2010 23:14:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/07/29/121522.htmlhttp://www.shnenglu.com/vontroy/comments/121522.htmlhttp://www.shnenglu.com/vontroy/archive/2010/07/29/121522.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/121522.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/121522.html#include <iostream>
#include 
<cstdio>
#include 
<algorithm>

const int MY_MAX = -99999999;
const int MY_MIN = 99999999;

using namespace std;

struct CNode
{
    
int R, L;
    
int nMax, nMin;
    CNode 
* pLeft, * pRight;
}Tree[
1000000];

//CNode Tree[1000000];
int nMax, nMin;
int nCount = 0;

void BuildTree( CNode * pRoot, int L, int R )
{
    pRoot
->= L;
    pRoot
->= R;

    pRoot
->nMax = MY_MAX;
    pRoot
->nMin =   MY_MIN;

    
if( R != L )
    {
        nCount
++;
        pRoot
->pLeft = Tree + nCount;
        nCount
++;
        pRoot
->pRight = Tree + nCount;
        BuildTree( pRoot
->pLeft, L, ( L + R ) / 2 );
        BuildTree( pRoot
->pRight, ( L + R ) / 2 + 1, R );
    }
}

void Insert( CNode * pRoot, int i, int v )
{
    
if( pRoot->== i &&pRoot-> R == i )
    {
        pRoot
-> nMin = pRoot-> nMax = v;
        
return ;
    }

    pRoot
->nMin = min( pRoot->nMin,v );
    pRoot
->nMax = max( pRoot->nMax, v );

    
if( i <= ( pRoot->+ pRoot->R ) / 2 )
        Insert( pRoot
->pLeft, i, v );
    
else
        Insert( pRoot
->pRight, i, v );
}

void Query( CNode * pRoot, int s, int e )
{
    
if( pRoot->nMax <= nMax && pRoot->nMin >= nMin )
        
return ;
    
if( s == pRoot->&& e == pRoot->R )
    {
        nMax 
= max(pRoot->nMax, nMax);
        nMin 
= min(pRoot->nMin,nMin);
        
return;
    }
    
if( e <= ( pRoot->+ pRoot->R ) / 2 )
        Query( pRoot
->pLeft, s, e );
    
else if ( s >= ( pRoot->+ pRoot->R ) / 2 + 1 )
        Query( pRoot
->pRight, s, e );
    
else
    {
        Query( pRoot
->pLeft, s, ( pRoot->+ pRoot->R ) / 2 );
        Query( pRoot
->pRight, ( pRoot->+ pRoot->R) / 2 + 1, e ) ;
    }
}

int main()
{
    
int n, q, s, e;
    
int h;
    scanf(
"%d%d"&n, &q);
    nCount 
= 0;
    BuildTree( Tree, 
1, n);
    
forint i = 1; i <= n; i++ )
    {
        scanf(
"%d"&h);
        Insert( Tree, i, h );
    }
    
forint i = 0; i < q; i++)
    {
        scanf(
"%d%d"&s,&e );
        nMax 
= MY_MAX;
        nMin 
= MY_MIN;
        Query( Tree, s, e );
        printf(
"%d\n", nMax - nMin) ;
    }
    
return 0;
}


Vontroy 2010-07-29 07:14 鍙戣〃璇勮
]]>
POJ 2528 Mayor's posters http://www.shnenglu.com/vontroy/archive/2010/07/28/121507.htmlVontroyVontroyWed, 28 Jul 2010 14:45:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/07/28/121507.htmlhttp://www.shnenglu.com/vontroy/comments/121507.htmlhttp://www.shnenglu.com/vontroy/archive/2010/07/28/121507.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/121507.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/121507.html#include <iostream>
#include 
<algorithm>
#include 
<math.h>
using namespace std;
int n;
struct CPost
{
    
int L,R;
};
CPost posters[
10100];
int x[20200];
int hash[10000010];
struct CNode 
{
    
int L,R;
    
bool bCovered; //鏈尯闂存槸鍚﹀凡緇忚瀹屽叏瑕嗙洊 
    CNode * pLeft, * pRight;
};
CNode Tree[
100000];
int nNodeCount = 0;
int Mid( CNode * pRoot)
{
    
return (pRoot->+ pRoot->R)/2;
}
void BuildTree( CNode * pRoot, int L, int R)
{
    pRoot
->= L;
    pRoot
->= R;
    pRoot
->bCovered = false;
    
if( L == R )
        
return;
    nNodeCount 
++;
    pRoot
->pLeft = Tree + nNodeCount;
    nNodeCount 
++;
    pRoot
->pRight = Tree + nNodeCount;
    BuildTree( pRoot
->pLeft,L,(L+R)/2);
    BuildTree( pRoot
->pRight,(L+R)/2 + 1,R);
}
bool Post( CNode  *pRoot, int L, int R)
{
    
if( pRoot->bCovered )
        
return false;
    
if( pRoot->== L && pRoot->== R) {
        pRoot
->bCovered = true;
        
return true;
    }
    
bool bResult ;
    
if( R <= Mid(pRoot) ) 
        bResult 
= Post( pRoot->pLeft,L,R);
    
else if( L >= Mid(pRoot) + 1)
        bResult 
= Post( pRoot->pRight,L,R);
    
else {
        
bool b1 = Post(pRoot->pLeft ,L,Mid(pRoot));
        
bool b2 = Post( pRoot->pRight,Mid(pRoot) + 1,R);
        bResult 
= b1 || b2;
    }
    
//瑕佹洿鏂版牴鑺傜偣鐨勮鐩栨儏鍐?/span>
    if( pRoot->pLeft->bCovered && pRoot->pRight->bCovered )
        pRoot
->bCovered = true;
    
return bResult;
}
int main()
{
    
int t;
    
int i,j,k;
    scanf(
"%d",&t);
    
int nCaseNo = 0;
    
while(t--) {
        nCaseNo 
++;
        scanf(
"%d",&n);
        
int nCount = 0;
        
for( i = 0;i < n;i ++ )  {
            scanf(
"%d%d"& posters[i].L,& posters[i].R );

            x[nCount
++= posters[i].L;
            x[nCount
++= posters[i].R;
        }
        sort(x,x
+nCount);
        nCount 
= unique(x,x+nCount) - x; //鍘繪帀閲嶅鍏冪礌
        for( i = 0;i < nCount;i ++ )
            hash[x[i]] 
= i;
        nNodeCount 
= 0;
        BuildTree( Tree,
0,nCount - 1);
        
int nSum = 0;
        
for( i = n - 1;i >= 0;i -- ) { // 浠庡悗寰鍓嶇湅鏉挎槸鍚︾湅寰楄
            if( Post(Tree,hash[posters[i].L],hash[posters[i].R]))
                nSum 
++;
        }
        printf(
"%d\n",nSum);
    }
    
return 0;
}


Vontroy 2010-07-28 22:45 鍙戣〃璇勮
]]>
色诱久久久久综合网ywww| 久久综合丁香激情久久| 少妇精品久久久一区二区三区| 狠狠色婷婷久久综合频道日韩| 精品久久久久久无码专区不卡| 久久本道伊人久久| 久久久这里有精品中文字幕| 久久人人爽人人爽人人片AV不 | 国内精品久久九九国产精品| 久久亚洲精品无码播放| 久久综合香蕉国产蜜臀AV| 久久久久久无码国产精品中文字幕 | 国产精品美女久久久m| 人妻中文久久久久| 国产精品久久久久久影院 | 久久久无码精品午夜| 97久久综合精品久久久综合| 亚洲国产精品综合久久一线| 99久久婷婷免费国产综合精品| 天堂无码久久综合东京热| 久久本道伊人久久| 久久99久国产麻精品66| 欧美色综合久久久久久| a级毛片无码兔费真人久久| 久久66热人妻偷产精品9| 99久久国产综合精品女同图片| 欧美国产成人久久精品| 岛国搬运www久久| 色综合久久天天综合| 久久精品无码午夜福利理论片| 久久国产欧美日韩精品| 亚洲欧美精品一区久久中文字幕| 久久精品无码一区二区三区免费 | 9久久9久久精品| 欧美牲交A欧牲交aⅴ久久| 国产精品久久久久久久久软件 | 久久精品国产精品青草| 久久精品亚洲日本波多野结衣| 亚洲国产欧美国产综合久久 | 久久国产免费观看精品| 久久综合给合久久国产免费|