• <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>

            Uriel's Corner

            Research Associate @ Harvard University / Research Interests: Computer Vision, Biomedical Image Analysis, Machine Learning
            posts - 0, comments - 50, trackbacks - 0, articles - 594

            POJ 3481 Double Queue---SBT/STL

            Posted on 2010-08-18 22:52 Uriel 閱讀(611) 評論(0)  編輯 收藏 引用 所屬分類: POJ數據結構
                    這題貌似最優解法是SBT,這個只看過,完全沒有敲過,想到STL set,于是水過去了。。。
                    對于STL,現在基本也只會priority queue, set, heap, map還基本沒怎么寫過,只能應付應付比賽的時候最基本的用法。。。
                    這題用set,C++比G++快一倍,282Ms,有點慢,不過代碼量很少~~

            //Problem: 3481  User: Uriel 
            //Memory: 840K  Time: 282MS 
            //Language: C++  Result: Accepted 
            //Version: STL => set
            //2010.08.18

            #include
            <set>
            #include
            <stdio.h>
            #include
            <stdlib.h>
            using namespace std;

            struct node{
                
            int id,p;
            }
            q;

            bool operator<(const node &a,const node &b){
                
            return a.p>b.p;
            }


            int main(){
                
            int x;
                
            set<node> st;
                
            while(scanf("%d",&x),x){        
                    
            if(x==1){
                        scanf(
            "%d %d",&q.id,&q.p);
                        st.insert(q);
                    }

                    
            else if(x==2){
                        
            if(st.empty()){
                            puts(
            "0");
                            
            continue;
                        }

                        printf(
            "%d\n",st.begin()->id);
                        st.erase(st.begin());
                    }

                    
            else if(x==3){
                        
            if(st.empty()){
                            puts(
            "0");
                            
            continue;
                        }

                        
            set<node>::iterator it;
                        it
            =st.end();
                        it
            --;
                        printf(
            "%d\n",it->id);
                        st.erase(st.find(
            *it));
                    }

                }

                
            return 0;
            }


            国产亚洲婷婷香蕉久久精品| yellow中文字幕久久网| 久久亚洲精品无码aⅴ大香| 日产精品久久久久久久| 久久99久久99小草精品免视看| 青青草原综合久久大伊人精品| 久久99精品久久久久久9蜜桃 | 97精品伊人久久久大香线蕉| 中文精品99久久国产| 狠狠久久亚洲欧美专区| 亚洲一区精品伊人久久伊人| 91精品国产91久久综合| 久久久久亚洲AV无码观看| 久久久久综合网久久| 亚洲色婷婷综合久久| 久久久久久国产a免费观看不卡| 99久久精品免费看国产一区二区三区 | 亚洲国产精品久久电影欧美| 久久天天躁狠狠躁夜夜不卡 | 日韩电影久久久被窝网| 狠狠狠色丁香婷婷综合久久五月| 久久精品国产久精国产果冻传媒| 国产精品综合久久第一页| 99久久精品影院老鸭窝| 亚洲国产美女精品久久久久∴| 久久人人爽人人爽人人片AV东京热| 97久久超碰成人精品网站| 久久精品国产亚洲αv忘忧草| 日韩一区二区三区视频久久| 久久国产成人亚洲精品影院| 色欲综合久久躁天天躁蜜桃| 精品久久久中文字幕人妻| 久久九九免费高清视频| 久久精品视屏| 狠狠色伊人久久精品综合网| 亚洲国产成人久久精品影视| 久久亚洲国产午夜精品理论片| 韩国三级大全久久网站| www亚洲欲色成人久久精品| 国产精久久一区二区三区| 色综合久久最新中文字幕|