• <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
                注意!
                是最長(zhǎng)不減序列(*1),而非最長(zhǎng)升序列(*2) 
                則當(dāng)t>=D[len]就直接更新len+1
                而t<D[len]時(shí),應(yīng)在D[1..len]中查找最大的j,滿足D[j]<=A[t](在*2中,是滿足D[j]<A[t]), 
                將t接在D[j]后得到更長(zhǎng)的不減序列,同時(shí)更新D[j+1]=t
                這是我WA很多次的地方.對(duì)這個(gè)算法未理解透徹 
                附一組原先錯(cuò)誤程序WA的數(shù)據(jù):
            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 閱讀(125) 評(píng)論(0)  編輯 收藏 引用 所屬分類: acm_icpc
            <2009年7月>
            2829301234
            567891011
            12131415161718
            19202122232425
            2627282930311
            2345678

            "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

            搜索

            •  

            最新評(píng)論

            評(píng)論排行榜

            久久亚洲国产成人影院| 国产亚洲精久久久久久无码 | 久久国产成人| 久久精品国产久精国产果冻传媒 | 2021少妇久久久久久久久久| 久久精品国产免费| 久久精品国产99久久久古代 | 国产精品18久久久久久vr | 久久青青草原亚洲av无码app| 麻豆精品久久精品色综合| 久久有码中文字幕| 91精品国产综合久久婷婷| 久久男人AV资源网站| 好属妞这里只有精品久久| 中文字幕精品久久| www亚洲欲色成人久久精品| 久久久免费精品re6| 性做久久久久久久久久久| 亚洲天堂久久精品| 九九久久99综合一区二区| 久久91精品国产91| 三级三级久久三级久久| 亚洲国产精品久久久久| 日产精品99久久久久久| 成人综合久久精品色婷婷| 免费一级做a爰片久久毛片潮| 久久―日本道色综合久久| 久久精品国产亚洲AV嫖农村妇女| 久久久这里只有精品加勒比| 久久久网中文字幕| 精品久久久久久久| 99久久免费国产精精品| 97精品伊人久久大香线蕉app| 久久精品国产久精国产思思| 久久国产色AV免费看| 久久成人国产精品| 狠色狠色狠狠色综合久久| 天天爽天天爽天天片a久久网| 青青草国产成人久久91网| 99久久精品免费观看国产| 国产成人精品久久亚洲|