• <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色综合久久天堂av色综合在| 精品一久久香蕉国产线看播放 | 精品国产乱码久久久久久呢| 色综合久久精品中文字幕首页| 国产成人久久AV免费| 国产精品成人久久久久三级午夜电影| 国产精品久久毛片完整版| 久久精品中文字幕久久| 伊人久久大香线蕉精品不卡| 色欲久久久天天天综合网| 99久久精品无码一区二区毛片| 久久免费视频6| 久久久久无码精品国产| 亚洲欧美日韩久久精品| 亚洲精品乱码久久久久久久久久久久| 久久亚洲欧美日本精品| 久久综合亚洲鲁鲁五月天| 国产人久久人人人人爽 | 久久精品人人做人人爽电影| 久久66热人妻偷产精品9| 久久久无码精品午夜| 69国产成人综合久久精品| 欧美噜噜久久久XXX| 久久无码国产| 99久久综合国产精品二区| 乱亲女H秽乱长久久久| 欧美黑人激情性久久| 久久涩综合| 亚洲成av人片不卡无码久久| 久久精品成人欧美大片| 99久久国产免费福利| 天天久久狠狠色综合| 精品久久久久久亚洲| 2021久久精品国产99国产精品| 久久久无码精品亚洲日韩蜜臀浪潮| 综合久久一区二区三区| 久久国产免费直播| 精品视频久久久久| 久久久精品免费国产四虎| 亚洲国产精品久久66| 天天综合久久久网|