青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

ArcTan

dfs
隨筆 - 16, 文章 - 117, 評論 - 6, 引用 - 0
數據加載中……

SRM549 DIVⅡ 500pt(最大匹配)

Problem Statement

     The Order of All Things Pointy and Magical has commissioned the creation of some new wizard hats. A wizard hat is created by taking two cones: a decorative top cone, and a warm and fluffy bottom cone. To assemble the hat, both cones are first placed onto a table, so that their bases are horizontal and their apexes point upwards. The top cone is then lifted and placed onto the bottom cone. The base of the top cone has to remain horizontal, and the apex of the top cone must be strictly above the apex of the bottom cone.

Not every pair of cones can be used to create a wizard hat. A wizard hat is only produced if the following two criteria are both met:
  • The apex of the top cone must be strictly above the apex of the bottom cone. I.e., when the top cone is placed on top of the bottom cone and released, their apexes must not touch.
  • Some part of the bottom cone must remain visible to form the brim of the hat. (Otherwise, the hat would look like a simple cone, not like a wizard hat!)
You have several top cones and several bottom cones of various sizes. Each cone can be described by its height (the distance between the apex and the base) and by the radius of its base. The top cones you have are described by topHeight and topRadius: for each valid i, you have one top cone with height topHeight[i] and radius topRadius[i]. The bottom cones you have are described by bottomHeight and bottomRadius in the same way.

Your task is to determine the maximum number of wizard hats you can make using each of the available top and bottom cones at most once.

Definition

    
Class: PointyWizardHats
Method: getNumHats
Parameters: vector <int>, vector <int>, vector <int>, vector <int>
Returns: int
Method signature: int getNumHats(vector <int> topHeight, vector <int> topRadius, vector <int> bottomHeight, vector <int> bottomRadius)
(be sure your method is public)
    

Constraints

- topHeight and topRadius will contain the same number of elements.
- bottomHeight and bottomRadius will contain the same number of elements.
- topHeight will contain between 1 and 50 elements, inclusive.
- topRadius will contain between 1 and 50 elements, inclusive.
- bottomHeight will contain between 1 and 50 elements, inclusive.
- bottomRadius will contain between 1 and 50 elements, inclusive.
- Each element of topHeight, topRadius, bottomHeight, and bottomRadius will be between 1 and 10,000, inclusive.

Examples

0)
    
{30}
{3}
{3}
{30}
Returns: 1
The top and bottom cone can be used together to make a wizard hat.
1)
    
{4,4}
{4,3}
{5,12}
{5,4}
Returns: 1
The only way to produce a wizard hat is to use the top cone 1 (height 4, radius 3) and the bottom cone 0 (height 5, radius 5).
2)
    
{3}
{3}
{1,1}
{2,4}
Returns: 1

3)
    
{10,10}
{2,5}
{2,9}
{3,6}
Returns: 2

4)
    
{3,4,5}
{5,4,3}
{3,4,5}
{3,8,5}
Returns: 2

5)
    
{1,2,3,4,5}
{2,3,4,5,6}
{2,3,4,5,6}
{1,2,3,4,5}
Returns: 0

6)
    
{123,214,232,323,342,343}
{123,123,232,123,323,434}
{545,322,123,545,777,999}
{323,443,123,656,767,888}
Returns: 5

7)
    
{999,999,999,10000,10000,10000}
{10000,10000,10000,1,2,3}
{2324,2323,234,5454,323,232}
{1,2,3222,434,5454,23}
Returns: 3


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.





題意:一個hat由上面top cone和下面的bottom cone組成。給定上面cone的高和底半徑,topHeigh[],topRadius[]下面cone的bottomHeight[],bottomRadius[]
         上下兩個cone組成hat需要滿足條件:
                  1:The apex of the top cone must be strictly above the apex of the bottom cone. I.e., when the top cone is placed on top of the bottom cone and released, their apexes must not touch.
                  2:Some part of the bottom cone must remain visible to form the brim of the hat. (Otherwise, the hat would look like a simple cone, not like a wizard hat!)


思路:求二分圖的最大匹配,模版題。
         topcone 和bottomcone滿足的條件是:topR<bottomR && topR*bottomH<topH*bottomR

錯誤提交了一次,尼瑪!!!猶豫不決不敢coding不行呀!!

175.22pt
              
#include<stdio.h>
#include
<string>
#include
<vector>
#include
<algorithm>
using namespace std;
bool map[55][55];
int result[55];
bool state[55];
int n,m;
class PointyWizardHats{
public:
    
int find(int x)
    {
        
int i;
        
for (i=0;i<m ;i++ )
        {
            
if (map[x][i]==1 && !state[i])
            {
                state[i]
=1;
                
if (result[i]==-1 || find(result[i]))
                {
                    result[i]
=x;
                    
return 1;
                }
            }
        }
        
return 0;
    }
    
bool can(int x1,int y1,int x2,int y2) //這個條件我猶豫了半天,thinking不夠啊!
    {
        
if (y2*x1>y1*x2 && y2>y1)
            
return 1;
        
return 0;
    }
    
int getNumHats(vector <int> topHeight, vector <int> topRadius, vector <int> bottomHeight, vector <int> bottomRadius){

        
int i,j;
        
int ans;
        n
=topHeight.size();
        m
=bottomHeight.size();
        memset(map,
0,sizeof(map));
        
for (j=0;j<m;j++)
            result[j]
=-1;    //這里之前全部設置的0啊啊啊!!!
        
for (i=0;i<n;i++)
            
for (j=0;j<m;j++)
                
if (can(topHeight[i],topRadius[i],bottomHeight[j],bottomRadius[j]))
                    map[i][j]
=1;
        ans
=0;
        
for (i=0;i<n;i++)
        {
            memset(state,
0,sizeof(state));
            
if (find(i))
                ans
++;
        }
        
return ans;
    }
};



posted on 2012-07-10 09:14 wangs 閱讀(279) 評論(0)  編輯 收藏 引用 所屬分類: Topcoder

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            亚洲美女诱惑| 免费精品视频| 久久综合给合| 亚洲午夜在线视频| 蜜臀久久久99精品久久久久久| 1000部国产精品成人观看| 亚洲国产欧美精品| 国产日产亚洲精品| 亚洲电影专区| 在线成人激情| 欧美自拍丝袜亚洲| 亚洲一区二区三区在线视频| 久久爱www久久做| 亚洲一区二区三区影院| 一区二区三区国产精华| 日韩一区二区精品在线观看| 国产一区二区三区四区三区四| 一区二区三区你懂的| 六月天综合网| 久久高清福利视频| 亚洲第一在线视频| 欧美日本久久| 久久精品综合网| 亚洲精品婷婷| 久久久久在线观看| 日韩一区二区精品葵司在线| 欧美成人一区二区在线| 午夜视频久久久| 亚洲一区二区三区精品视频| 一区二区日本视频| 亚洲大片av| 午夜在线不卡| 久久精品亚洲精品| 国产精品色网| 亚洲黄色在线视频| 亚洲国产aⅴ天堂久久| 亚洲欧美日韩区| 午夜精品久久| 国产精品综合| 一本一本a久久| 亚洲性夜色噜噜噜7777| 欧美aaaaaaaa牛牛影院| 麻豆精品国产91久久久久久| 亚洲国产精品一区二区三区| 久久精品国产精品亚洲综合 | 国产精品亚洲欧美| 一区二区日韩| 久久久www免费人成黑人精品| 亚洲最新色图| 久久国产黑丝| 亚洲国产日韩一级| 夜夜狂射影院欧美极品| 国产揄拍国内精品对白| 欧美午夜不卡影院在线观看完整版免费 | 一区二区三区四区国产| 亚洲午夜黄色| 亚洲午夜电影网| 在线免费精品视频| 欧美一区二区三区四区在线观看地址 | 欧美一区二区精美| 亚洲午夜高清视频| 欧美另类一区二区三区| 亚洲国产毛片完整版| 在线免费观看视频一区| 久久激情五月激情| 久久久亚洲一区| 韩国精品一区二区三区| 亚洲一区影音先锋| 亚洲黄色天堂| 亚洲欧美日韩一区二区三区在线观看| 99国产精品99久久久久久粉嫩 | 亚洲第一二三四五区| 欧美中在线观看| 蜜桃久久av一区| 在线看片欧美| 欧美伦理影院| 亚洲视频视频在线| 欧美中文在线观看国产| 国内精品视频久久| 噜噜噜躁狠狠躁狠狠精品视频 | 欧美亚洲视频在线看网址| 国产精品一区在线播放| 久久精品91久久久久久再现| 麻豆国产精品一区二区三区 | 亚洲国产1区| 欧美精品一区二区三| 99精品视频一区| 久久精品国产清自在天天线| 在线播放不卡| 欧美日韩高清在线播放| 亚洲欧美日韩国产中文| 免费欧美日韩国产三级电影| 亚洲裸体俱乐部裸体舞表演av| 欧美视频在线观看 亚洲欧| 亚洲欧美卡通另类91av| 麻豆91精品91久久久的内涵| 99爱精品视频| 国产自产精品| 欧美激情精品久久久久久久变态| 一区二区三区四区五区精品| 久久久久欧美精品| 最新亚洲电影| 国产精品久久久久久久免费软件 | 欧美三级中文字幕在线观看| 欧美一区二区三区成人| 91久久国产综合久久| 欧美资源在线观看| 亚洲免费观看在线观看| 国产精品一区二区在线观看网站| 免费中文字幕日韩欧美| 亚洲欧美成人网| 亚洲毛片在线观看.| 美女脱光内衣内裤视频久久影院| 国产精品99久久久久久久女警 | 亚洲精品午夜| 韩国成人福利片在线播放| 欧美视频免费在线观看| 欧美91大片| 久久精品日韩一区二区三区| 国产主播一区二区| 欧美日韩综合在线| 欧美福利精品| 毛片基地黄久久久久久天堂| 久久不射中文字幕| 午夜精品久久久久久久白皮肤 | 免费在线观看精品| 久久精品国产96久久久香蕉| 亚洲一区二区三区精品在线| 亚洲精品婷婷| 亚洲激情视频在线观看| 亚洲电影一级黄| 一区二区三区在线免费视频| 国产婷婷色一区二区三区四区 | 欧美国产欧美亚洲国产日韩mv天天看完整| 欧美一区二区在线视频| 亚洲直播在线一区| 亚洲一区精品在线| 亚洲综合精品| 午夜精品理论片| 欧美一进一出视频| 欧美在线视频观看| 久久精品国产91精品亚洲| 欧美一区午夜精品| 久久精品卡一| 另类激情亚洲| 欧美fxxxxxx另类| 欧美激情aⅴ一区二区三区| 欧美国产日韩一区二区在线观看| 欧美成人精品一区二区| 欧美激情亚洲综合一区| 欧美日本高清| 欧美性开放视频| 国产乱肥老妇国产一区二| 国产午夜精品久久| 曰韩精品一区二区| 99re8这里有精品热视频免费| 99ri日韩精品视频| 性欧美激情精品| 久久视频一区| 亚洲国产你懂的| 日韩午夜av在线| 亚洲综合日韩在线| 久久视频在线视频| 欧美连裤袜在线视频| 国产精品美女黄网| 国产综合香蕉五月婷在线| 亚洲高清视频一区| 亚洲在线一区二区| 久久综合狠狠综合久久综青草| 欧美电影免费观看大全| 99精品国产福利在线观看免费| 亚洲一区二区三区四区视频| 久久免费视频网站| 欧美日韩在线三区| 伊人精品久久久久7777| 一本一本久久a久久精品综合妖精| 午夜精品久久久久久久久久久久久| 久久精品视频一| 亚洲精品系列| 久久国产精品一区二区| 欧美日韩国产限制| 精品动漫一区| 亚洲一区免费| 欧美黄色aa电影| 午夜精品福利一区二区蜜股av| 蜜桃av噜噜一区二区三区| 国产精品乱码| 亚洲精品美女91| 久久精品电影| 99这里只有精品| 美女脱光内衣内裤视频久久影院 | 欧美日韩综合久久| 亚洲大片在线| 久久人91精品久久久久久不卡| 99re6热在线精品视频播放速度| 久久久久国产精品一区三寸| 国产精品日韩一区二区| 夜夜嗨av色综合久久久综合网| 国产精品欧美一区喷水 | 激情伊人五月天久久综合|