• <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 閱讀(362) 評論(0)  編輯 收藏 引用 所屬分類: 格式.輸入輸出.數據類型
            <2012年11月>
            28293031123
            45678910
            11121314151617
            18192021222324
            2526272829301
            2345678

            常用鏈接

            留言簿(3)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            友情鏈接

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            精品久久久久久久| 精品无码久久久久久久久久| 97久久婷婷五月综合色d啪蜜芽 | 久久久精品波多野结衣| 久久本道伊人久久| 综合久久一区二区三区 | 亚洲AV日韩精品久久久久久久| 精品久久无码中文字幕| 欧美麻豆久久久久久中文| 久久精品无码专区免费青青| 久久精品国产一区二区三区不卡| 99久久精品免费看国产一区二区三区| 国产精品久久精品| 亚洲综合伊人久久综合| 久久男人中文字幕资源站| 精品久久久久久国产| 色欲久久久天天天综合网精品| 久久综合九色欧美综合狠狠| 久久99国产精一区二区三区| 久久夜色精品国产噜噜麻豆| 超级97碰碰碰碰久久久久最新 | 亚洲AⅤ优女AV综合久久久| 日本免费久久久久久久网站 | 国产亚州精品女人久久久久久| av无码久久久久不卡免费网站| 婷婷久久五月天| 综合久久精品色| 久久这里只有精品首页| 久久综合久久美利坚合众国| 久久无码人妻精品一区二区三区 | 久久精品无码免费不卡| 91久久婷婷国产综合精品青草 | 国产91久久综合| 99久久99久久精品国产片果冻 | 久久久久国产精品三级网| 精品久久久久久99人妻| 久久激情亚洲精品无码?V| 久久人人爽人人爽人人片AV麻豆 | 18岁日韩内射颜射午夜久久成人| 亚洲欧洲精品成人久久曰影片| 一本久道久久综合狠狠躁AV|