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

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 閱讀(285) 評論(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>
            亚洲人成在线观看一区二区| 日韩午夜在线观看视频| 亚洲免费视频一区二区| 国产精品久久久久9999吃药| 中文国产成人精品| 一本色道精品久久一区二区三区| 欧美日韩视频| 亚洲一品av免费观看| 亚洲性感美女99在线| 国产欧美日韩免费看aⅴ视频| 久久精品一区二区国产| 久久久久久国产精品一区| 在线 亚洲欧美在线综合一区| 亚洲电影欧美电影有声小说| 欧美日韩少妇| 久久福利资源站| 麻豆av一区二区三区| 99热免费精品在线观看| 亚洲天堂成人在线视频| 国产欧美日韩综合| 男女激情视频一区| 欧美精品一区在线发布| 午夜精品一区二区在线观看| 久久久久久夜精品精品免费| 亚洲美女av电影| 亚洲尤物在线视频观看| 亚洲高清视频在线| 一区二区免费在线观看| 在线精品亚洲| 一区二区三区四区国产| 136国产福利精品导航| 一本色道精品久久一区二区三区| 狠狠久久亚洲欧美专区| 日韩小视频在线观看| 国产中文一区二区三区| 亚洲久色影视| 在线欧美不卡| 亚洲欧美日韩视频二区| 日韩视频一区二区三区| 欧美一区二区在线免费观看| 一区二区三区日韩精品视频| 久久久久久久久久久久久女国产乱 | 亚洲一区二区精品在线| 亚洲经典一区| 亚欧成人精品| 亚洲欧美www| 欧美激情影音先锋| 欧美成年人视频网站| 国产色产综合产在线视频| 亚洲精品日韩一| 伊人久久综合97精品| 午夜欧美大尺度福利影院在线看| 亚洲性视频h| 欧美激情一区| 亚洲高清不卡av| 亚洲二区视频| 久久精品亚洲精品| 亚洲欧美日本视频在线观看| 欧美日韩高清不卡| 亚洲电影在线观看| 亚洲国产日韩美| 久久伊人一区二区| 久久久欧美精品| 国产一区二区三区四区三区四| 亚洲在线免费观看| 亚洲欧美成人在线| 国产精品久久久亚洲一区 | 欧美大色视频| 一区二区在线看| 久久久久久伊人| 免费高清在线视频一区·| 一区二区三区在线观看视频| 久久国产88| 美女视频一区免费观看| 亚洲福利视频一区| 久久天堂国产精品| 欧美黄色小视频| 亚洲精品中文字| 欧美日韩四区| 亚洲无玛一区| 久久久欧美精品| 亚洲国产欧美日韩| 欧美精品在线免费观看| 99国产一区| 欧美一区激情视频在线观看| 韩国精品在线观看| 久久久久久亚洲精品中文字幕| 欧美国产视频在线观看| 99热这里只有成人精品国产| 国产精品多人| 久久精品国产久精国产一老狼| 欧美激情精品久久久久久免费印度 | 欧美伦理a级免费电影| 在线一区免费观看| 久久精品国产久精国产一老狼| 一区二区三区自拍| 欧美精品一区二区三区高清aⅴ| 一区二区免费在线播放| 久久久91精品国产| 最新成人av在线| 国产精品乱人伦中文| 久久夜色精品国产噜噜av| 亚洲美女黄色片| 久久久久久精| 在线一区亚洲| 在线观看视频欧美| 欧美肉体xxxx裸体137大胆| 香蕉av777xxx色综合一区| 欧美高清视频一区| 香蕉乱码成人久久天堂爱免费| 亚洲大片精品永久免费| 国产精品毛片| 免费在线亚洲| 欧美一区二区免费| 亚洲久久视频| 美日韩精品免费| 午夜精品福利电影| 亚洲精品看片| 激情五月***国产精品| 国产精品久线观看视频| 欧美精品一区二区精品网| 欧美在线观看网站| 一本色道综合亚洲| 亚洲成人在线网站| 久久资源av| 久久精品国产精品| 亚洲在线一区二区| 日韩亚洲国产欧美| 亚洲国产精品一区制服丝袜| 国产一区二区高清| 国产精品亚洲综合色区韩国| 欧美日韩高清在线| 美女亚洲精品| 久久久亚洲午夜电影| 欧美在线亚洲综合一区| 亚洲先锋成人| 亚洲视频 欧洲视频| 99国产精品| 99re这里只有精品6| 亚洲欧洲日本一区二区三区| 欧美成人午夜| 欧美jizzhd精品欧美巨大免费| 久久精品国产96久久久香蕉| 欧美一区不卡| 欧美影院午夜播放| 欧美在线一区二区三区| 欧美在线观看视频在线| 欧美一区2区三区4区公司二百| 亚洲专区在线视频| 亚洲欧美三级伦理| 午夜精品久久久久| 欧美一区二区三区免费视| 小黄鸭精品密入口导航| 欧美在线三级| 久久精品视频va| 久久亚洲国产成人| 免费观看一级特黄欧美大片| 欧美大片va欧美在线播放| 欧美成人免费在线| 亚洲激情成人| 99精品久久久| 午夜精品久久久久久久白皮肤| 欧美一区二区播放| 久久久久久久一区二区三区| 久热国产精品视频| 欧美久久久久久久| 国产精品高潮呻吟视频| 国产区日韩欧美| 在线观看视频欧美| 99亚洲一区二区| 亚洲欧美日韩综合国产aⅴ| 久久久久国产一区二区三区| 欧美激情网友自拍| 99综合在线| 久久国产精品网站| 欧美—级a级欧美特级ar全黄| 国产精品国产成人国产三级| 国产资源精品在线观看| 亚洲欧洲日产国码二区| 亚洲综合成人婷婷小说| 老妇喷水一区二区三区| 亚洲精品免费电影| 欧美亚洲在线播放| 欧美激情视频免费观看| 国产日韩欧美精品综合| 亚洲精品永久免费| 欧美专区在线观看| 亚洲欧洲一区| 久久国产精品久久久久久电车 | 亚洲视频欧美视频| 久久色在线观看| 国产精品第2页| 亚洲国产综合91精品麻豆| 亚洲欧美视频| 亚洲精品免费在线播放| 久久久91精品国产一区二区三区| 欧美日韩一区二区三| 亚洲国产成人一区| 久久久精品日韩| 亚洲视频一二三|