• <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 閱讀(357) 評論(0)  編輯 收藏 引用 所屬分類: 格式.輸入輸出.數據類型
            <2012年8月>
            2930311234
            567891011
            12131415161718
            19202122232425
            2627282930311
            2345678

            常用鏈接

            留言簿(3)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            友情鏈接

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久国产精品久久精品国产| 久久亚洲av无码精品浪潮| 亚洲精品97久久中文字幕无码| 久久久久久综合网天天| 99久久国产精品免费一区二区| 欧美综合天天夜夜久久| 99精品国产综合久久久久五月天 | 久久狠狠爱亚洲综合影院 | 久久精品国产亚洲7777| 久久人爽人人爽人人片AV| 国内精品伊人久久久久影院对白| 欧美日韩精品久久免费| 99久久国产热无码精品免费久久久久 | 91精品国产综合久久香蕉 | 久久偷看各类wc女厕嘘嘘| 99久久精品国产一区二区三区| 2021国产精品久久精品| 久久精品成人影院| 7777久久亚洲中文字幕| 亚洲成色www久久网站夜月| 亚洲欧洲精品成人久久奇米网| 国产成人无码久久久精品一| 麻豆AV一区二区三区久久| 色播久久人人爽人人爽人人片aV| 久久精品国产亚洲一区二区三区| 久久综合精品国产二区无码| 久久久久国产精品嫩草影院| 久久天天躁狠狠躁夜夜2020老熟妇| 精品综合久久久久久888蜜芽| 亚洲国产精品一区二区久久hs| 久久天天日天天操综合伊人av| 99久久国产亚洲高清观看2024| 久久久国产精品福利免费| 亚洲成色999久久网站| 97热久久免费频精品99| 精品永久久福利一区二区| 国产精品美女久久久久久2018| 久久精品国产亚洲AV高清热| 欧美一区二区精品久久| 99热精品久久只有精品| 久久综合成人网|