• <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)  編輯 收藏 引用 所屬分類: 格式.輸入輸出.數據類型
            <2025年7月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            常用鏈接

            留言簿(3)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            友情鏈接

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久综合九色综合97_久久久| 色综合合久久天天综合绕视看| 久久久综合九色合综国产| 九九久久99综合一区二区| 久久久久国产一区二区三区| 久久久久国产精品嫩草影院 | 狠狠色婷婷久久一区二区三区| 久久无码AV中文出轨人妻| 一本色道久久综合狠狠躁| 国产精品九九九久久九九 | 2020久久精品亚洲热综合一本 | 日韩一区二区久久久久久| 久久综合成人网| 99久久久精品| 无码八A片人妻少妇久久| 亚洲国产精品久久久久婷婷老年 | 国产成人精品久久一区二区三区av| 久久久网中文字幕| 99国产欧美久久久精品蜜芽| 久久亚洲国产成人影院网站| 久久福利青草精品资源站| 亚洲香蕉网久久综合影视| 亚洲国产婷婷香蕉久久久久久| 狠狠狠色丁香婷婷综合久久五月| 久久婷婷五月综合国产尤物app| 女人香蕉久久**毛片精品| 婷婷久久久亚洲欧洲日产国码AV| 久久综合伊人77777麻豆| 99久久国语露脸精品国产| 久久婷婷五月综合97色| 2021国内久久精品| 亚洲欧美日韩久久精品| 狠狠色丁香婷婷久久综合 | 91精品国产综合久久久久久| 老男人久久青草av高清| 天天综合久久一二三区| 久久久无码精品亚洲日韩软件| 天天综合久久一二三区| 狠狠久久综合伊人不卡| 93精91精品国产综合久久香蕉| 免费精品99久久国产综合精品|