• <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 - 195,  comments - 30,  trackbacks - 0
            A perfect point set is a set of points, for every point (x,y) in this set, point (y,x) is also in this set.

            Input

            There are mutical cases for this problem. For every input case, there is a set. we give you the number of points in this set in the first line, followed by n lines,each give two integers x y.

            Output

            If this set is a perfect set, you should print "Yes", else you print "No".

            Sample Input

            4
            1 4
            4 1
            2 5
            5 2
            

            Sample Output

            Yes
            1,這種類似稀疏矩陣的數組對一般不用數組存儲,用結構體比較好
            2,排序后比較非常的巧妙。
            #include<iostream>
            #include<cstdlib>
            using namespace std;
            struct mm{
            double a;
            double b;}M[100000];
            bool  operator<(mm m1,mm m2)
            {
            if(m1.a<m2.a)
            return true;
            else
            {
            if(m1.a==m2.a&&m1.b<m2.b)
            return true;
            }
            return false;
            }
            int main()
            {
            // freopen("s.txt","r",stdin);
            // freopen("key.txt","w",stdout);
            int num;
            double a,b;
            int temp=0;
            while(cin>>num)
            {
            memset(M,0,sizeof(M));
            temp=0;
            for(int k=0;k<num;k++)
            {
            cin>>a>>b;
            if(a<b)
            {
            M[temp].a=a;
            M[temp].b=b;
            temp++;
            }
            else if(a>b)//把a和b相等的都去掉了
            {
            M[temp].a=b;
            M[temp].b=a;
            temp++;
            }
            }
            if(temp%2!=0)cout<<"No"<<endl;
            else
            {
            sort(M,M+temp);
            int flag=0;
            for(int p=0;p<temp;p+=2)
            {
            if(M[p].b!=M[p+1].b||M[p].a!=M[p+1].a)
            {
            flag=1;break;
            }
            }
            if(flag==0)
            cout<<"Yes"<<endl;
            else
            cout<<"No"<<endl;
            }
            }
            //system("PAUSE");
            return   0;
            }
            
            posted on 2009-07-03 16:43 luis 閱讀(351) 評論(0)  編輯 收藏 引用 所屬分類: 格式.輸入輸出.數據類型
            <2012年2月>
            2930311234
            567891011
            12131415161718
            19202122232425
            26272829123
            45678910

            常用鏈接

            留言簿(3)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            友情鏈接

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            天天久久狠狠色综合| 久久精品日日躁夜夜躁欧美| 高清免费久久午夜精品| 久久r热这里有精品视频| 国产99久久久国产精免费| 日产久久强奸免费的看| 久久天天躁夜夜躁狠狠躁2022| 日韩人妻无码一区二区三区久久| 精品久久久噜噜噜久久久| 久久久WWW成人| 精品久久8x国产免费观看| 性做久久久久久久久| 国产精品美女久久久久网| 亚洲成av人片不卡无码久久| 久久精品中文闷骚内射| 久久久久久久91精品免费观看| 91久久婷婷国产综合精品青草| 香蕉久久夜色精品国产尤物| 亚洲国产精品久久久久久| 亚洲va久久久噜噜噜久久狠狠| 久久久精品视频免费观看| 久久精品中文字幕无码绿巨人| 亚洲а∨天堂久久精品9966| 国产女人aaa级久久久级| 久久国产精品成人免费| 奇米影视7777久久精品| 国内精品人妻无码久久久影院导航| 国产精品无码久久综合网| 久久电影网一区| www.久久精品| 国产亚洲婷婷香蕉久久精品| 久久久久AV综合网成人 | 久久人人爽人人澡人人高潮AV| 久久精品亚洲日本波多野结衣| 久久这里只有精品18| 久久婷婷五月综合色高清| 国产亚洲综合久久系列| 国产欧美久久久精品| 国产精品免费看久久久香蕉| 国产99久久九九精品无码| 久久人人爽人人爽AV片|