• <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 - 74,  comments - 33,  trackbacks - 0
            Taxi

            Time Limit: 1 Second ???? Memory Limit: 32768 KB

            As we all know, it often rains suddenly in Hangzhou during summer time.I suffered a heavy rain when I was walking on the street yesterday, so I decided to take a taxi back school. I found that there were n people on the street trying to take taxis, and m taxicabs on the street then. Supposing that the cars waited still and each person walked at a speed of v, now given the positions of the n persons and the m taxicabs, you should find the minimum time needed for all the persons to get on the taxicabs. Assume that no two people got on the same taxicab.

            Input

            For each case, you are given two integers 0 <= n <= 100 and n <= m <= 100 on the first line, then n lines, each has two integers 0 <= Xi, Yi <= 1000000 describing the position of the ith person, then m lines, each has two integers 0 <= xi, yi <= 1000000 describing the position the ith taxicab, then a line has a float 0.00001 < v <= 10000000 which is the speed of the people.

            Output

            You shuold figue out one float rounded to two decimal digits for each case.

            Sample Input

            2 3
            0 0
            0 1
            1 0
            1 1
            2 1
            1
            

            Sample Output

            1.00
            本來以為是dp求解的,后來誤以為KM做了一下,無果,后來想了想類似Max_Match搜索TLE
            后來找到了這句話
            -----------------------------------------------------------------------
            n個人乘坐m個的(dˉe),已知人和的的坐標和人的速度,問每個人都打上
            的的最短時間。假設的的位置不能變且沒有兩個人打同一個的。
            假設T時間內大家都可以打上的,那么對于t > T的時間,大家也可以
            打上的。因此,問題可以二分求解。
            對于給定的T,如果人可以在該時間內走到某個的的位置,就在人和的
            之間連一條邊。于是問題的可行就要求該二分圖的最大匹配數等于n。求
            二分圖最大匹配可以用Hungary算法。


            ----------------------------------------------------------------
            來源:http://cuitianyi.com/ZOJ200901.pdf
            就居然明白了原來類最小最優比例生成樹,我二分的時候是利用最大時間上限t二分 每次原圖中T<=t建圖得到
            邊 1 ,否則無邊。。結構很無情TLE,看了一下數據范圍 1000000 0.00001 < v <= 10000000 郁悶。
            隨后改成把所有時間存儲在Time數組中然后在數組中二分 不幸的是CE。Faint!!
            原來是自己用了link做了數組標號,而C++優link函數。。。。。。A的很曲折。膜拜大牛的解題報告給了二分的思路
            (今天我是想不到)
            部分代碼如下:
            double?dis(NODE?a,NODE?b){
            ????
            return?sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));????
            }

            bool?DFS(int?x){
            ????
            for(int?i=0;i<m;i++)
            ????????
            if(mark[x][i]&&!visited[i]){
            ????????????visited[i]
            =true;
            ????????????
            if(linkn[i]==-1||DFS(linkn[i])){
            ????????????????linkn[i]
            =x;
            ????????????????
            return?true;????
            ????????????}
            ????
            ????????}

            ????
            return?false;????????
            }

            bool?Max_Match(){
            ????
            int?i,sum=0;
            ????memset(linkn,
            0xff,sizeof(linkn));
            ????
            for(i=0;i<n;i++){
            ????????memset(visited,
            0,sizeof(visited));
            ????????DFS(i);
            ????}

            ????
            for(i=0;i<m;i++)
            ????????
            if(linkn[i]!=-1)sum++;
            ????
            if(sum==n)return?true;
            ????
            else?return?false;????
            }

            void?change(double?x){
            ????
            for(int?i=0;i<n;i++)
            ????????
            for(int?j=0;j<m;j++)
            ????????????
            if(x>=map[i][j])mark[i][j]=true;
            ????????????
            else?mark[i][j]=false;????
            }
            posted on 2009-04-17 14:32 KNIGHT 閱讀(159) 評論(0)  編輯 收藏 引用
            <2009年5月>
            262728293012
            3456789
            10111213141516
            17181920212223
            24252627282930
            31123456

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            Friends

            OJ

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            好久久免费视频高清| 久久久久亚洲精品日久生情| 欧洲人妻丰满av无码久久不卡 | 精品国产青草久久久久福利| 一级A毛片免费观看久久精品| 久久精品国产亚洲AV蜜臀色欲 | 久久婷婷人人澡人人爽人人爱 | 久久99热这里只有精品66| 亚洲中文字幕无码久久2020| 国产麻豆精品久久一二三| 久久99精品久久久久久不卡| 精品久久亚洲中文无码| 日本精品久久久久中文字幕8| 亚洲一区精品伊人久久伊人| 亚洲精品无码专区久久久 | 国产精品禁18久久久夂久| 久久精品亚洲男人的天堂| 精品久久久久久无码专区不卡| 久久久久亚洲av毛片大| 精品国产乱码久久久久久1区2区 | 久久偷看各类wc女厕嘘嘘| 久久亚洲精品无码播放| 99久久无码一区人妻a黑| 99久久做夜夜爱天天做精品| 国内精品久久久久久久亚洲| 亚洲AV无码一区东京热久久 | 国产精品99久久久精品无码| 国产精品99久久久久久董美香| 久久丫精品国产亚洲av| 97精品依人久久久大香线蕉97 | 久久免费视频6| 久久亚洲精品中文字幕三区| 久久久久久亚洲AV无码专区| 精品国产乱码久久久久软件 | 久久久久久a亚洲欧洲aⅴ | 热re99久久6国产精品免费| 久久亚洲国产精品成人AV秋霞| 精品熟女少妇AV免费久久| 要久久爱在线免费观看| 亚洲精品乱码久久久久久蜜桃| 久久久久人妻精品一区三寸蜜桃|