• <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久久精品影院老鸭窝| 精品一区二区久久| 热RE99久久精品国产66热| 久久久久亚洲精品日久生情| 99久久精品国产高清一区二区| 亚洲午夜久久久精品影院| 香蕉久久永久视频| 久久不射电影网| 亚洲香蕉网久久综合影视| 日本精品久久久久中文字幕8| 久久综合久久综合亚洲| 99久久精品国产综合一区| 国产美女亚洲精品久久久综合| 国产精品热久久毛片| 精品蜜臀久久久久99网站| 日韩精品久久久久久久电影| 亚洲国产精品人久久| 久久亚洲精品国产精品| 久久人人爽人人爽人人片AV不| 91久久精品国产91性色也| 97久久精品人妻人人搡人人玩 | 亚洲伊人久久大香线蕉苏妲己| 麻豆久久| 国产成人精品久久综合| 久久综合久久综合九色| 久久亚洲高清观看| avtt天堂网久久精品| 久久久久无码精品国产不卡| 亚洲精品无码专区久久久| 武侠古典久久婷婷狼人伊人| 狠狠色丁香婷婷综合久久来来去| 亚洲国产精品久久| 久久美女网站免费| 久久久久久狠狠丁香| 国产精品久久久久影视不卡| 99久久精品国产高清一区二区| 1000部精品久久久久久久久| 精品久久久久久亚洲精品 | 亚洲精品99久久久久中文字幕|