• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 43,  comments - 9,  trackbacks - 0
            /*
                bupt 1032
                nlogn LIS
                注意!
                是最長不減序列(*1),而非最長升序列(*2) 
                則當t>=D[len]就直接更新len+1
                而t<D[len]時,應在D[1..len]中查找最大的j,滿足D[j]<=A[t](在*2中,是滿足D[j]<A[t]), 
                將t接在D[j]后得到更長的不減序列,同時更新D[j+1]=t
                這是我WA很多次的地方.對這個算法未理解透徹 
                附一組原先錯誤程序WA的數據:
            40
            9 7 10 13 18 4 13 37 24 7 30 17 36 20 23 26 35 16 7 25 7 30 39 3 9 11 14 8 29 35 35 17 6 11 25 25 21 17 32 38 
            答案12
            */
            #include 
            <iostream>
            using namespace std;
            int T,N,m,cnt,r[50010];
            int main(){
                
            int i,j,k;
                scanf(
            "%d",&T);
                
            while(T--){
                    scanf(
            "%d",&N);
                    cnt
            =0; r[0]=-1
                    
            for(i=1;i<=N;i++){
                        scanf(
            "%d",&m);
                        
            if(m>=r[cnt]){ //not '>'
                            r[++cnt]=m;
                        }
                        
            else{
                            
            int bl=1,bh=cnt,bm;
                            k
            =-1;
                            
            while(bl<=bh){
                                bm
            =(bl+bh)/2;
                                
            if(r[bm]>m){ //not '>='  
                                    bh=bm-1;
                                    k
            =bm;
                                }
                                
            else bl=bm+1;
                            }
                            r[k]
            =m;
                        }
                    }
                    printf(
            "%d\n",cnt);
                }
                
            return 0;
            }

            posted on 2009-03-27 13:23 wolf5x 閱讀(124) 評論(0)  編輯 收藏 引用 所屬分類: acm_icpc
            <2009年6月>
            31123456
            78910111213
            14151617181920
            21222324252627
            2829301234
            567891011

            "Do not spend all your time on training or studying - this way you will probably become very exhausted and unwilling to compete more. Whatever you do - have fun. Once you find programming is no fun anymore – drop it. Play soccer, find a girlfriend, study something not related to programming, just live a life - programming contests are only programming contests, and nothing more. Don't let them become your life - for your life is much more interesting and colorful." -- Petr

            留言簿(3)

            隨筆分類(59)

            隨筆檔案(43)

            cows

            搜索

            •  

            最新評論

            評論排行榜

            中文国产成人精品久久不卡| 国产99精品久久| 四虎影视久久久免费| 伊人色综合久久天天人守人婷 | 国产99久久久国产精品小说| 婷婷久久综合九色综合绿巨人| 亚洲国产精品久久久天堂| 99久久精品免费看国产| 久久精品国产亚洲AV久| 国产精品久久久久…| 久久久久久久久久久精品尤物| 久久久av波多野一区二区| 久久996热精品xxxx| 久久成人国产精品| 久久精品一本到99热免费| 99久久免费只有精品国产| 无码专区久久综合久中文字幕| 精品久久久久久无码人妻热| 99久久成人国产精品免费| 久久亚洲AV无码精品色午夜| 狠狠久久综合伊人不卡| 国内精品久久九九国产精品| 人妻无码久久一区二区三区免费| 一日本道伊人久久综合影| 国产精品日韩欧美久久综合| 久久久久人妻一区精品性色av| 欧美国产成人久久精品| 久久这里的只有是精品23| 久久久久亚洲AV成人网人人网站| 99久久免费国产精品| 久久青青草原国产精品免费 | 无码任你躁久久久久久老妇| 精品久久国产一区二区三区香蕉| 2020最新久久久视精品爱| 国产亚洲婷婷香蕉久久精品| 97久久国产亚洲精品超碰热| 久久精品国产亚洲AV大全| 人妻精品久久久久中文字幕一冢本| 久久久久99这里有精品10| 99久久这里只精品国产免费| 国内精品综合久久久40p|