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

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            友情鏈接

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            精品无码久久久久国产动漫3d| 亚洲精品高清国产一线久久| 国内精品免费久久影院| 热99re久久国超精品首页| 精品久久人人爽天天玩人人妻 | 99麻豆久久久国产精品免费| 久久九九青青国产精品| 欧美精品一区二区久久| 欧美大香线蕉线伊人久久| 丁香久久婷婷国产午夜视频| 日本WV一本一道久久香蕉| 亚洲国产成人久久综合一区77| 精品久久一区二区| 久久久国产精品福利免费| 久久国产成人精品国产成人亚洲| 久久久久人妻一区二区三区| 精品久久人人爽天天玩人人妻| 亚洲国产精品无码久久久蜜芽| 爱做久久久久久| 久久本道伊人久久| 久久亚洲中文字幕精品有坂深雪 | 国产精品熟女福利久久AV| 亚洲精品乱码久久久久久| 久久久久亚洲精品男人的天堂| 久久久噜噜噜www成人网| 欧美午夜A∨大片久久 | 久久九九青青国产精品| 色综合久久综合中文综合网| 欧美精品乱码99久久蜜桃| 色欲综合久久中文字幕网 | 久久婷婷五月综合97色一本一本 | 久久久亚洲精品蜜桃臀| 777米奇久久最新地址| 久久久无码一区二区三区| 久久天天躁狠狠躁夜夜网站| 久久精品国产欧美日韩99热| 色8激情欧美成人久久综合电| 久久伊人五月天论坛| 亚洲国产成人久久综合一区77| 日本久久中文字幕| 亚洲午夜无码AV毛片久久|