ÉèΪÊ×Ò³ ¼ÓÈëÊÕ²Ø

TOP

²»¶¨¸ù×îСÊ÷ÐÎͼʵÀý·ÖÎö(Ò»)
2013-12-05 13:05:29 À´Ô´: ×÷Õß: ¡¾´ó ÖРС¡¿ ä¯ÀÀ:269´Î
Tags£º²»¶¨ ×îС Ê÷ÐΠʵÀý·ÖÎö

    Ê×ÏÈÊÇ×îСÊ÷ÐÎͼµÄ½éÉÜ¡£
    ¿´Õâ¸ö²©¿Í¡£×îСÊ÷ÐÎͼ
    ÉÏÃæ½éÉܵĺÜÏêϸÁË£¬ÎҾͽ²Ò»ÏÂÕâµÀÌâµÄÌâÒâ¡£
    Ê×Ïȸø³öһЩ¶þάµã×ø±ê£¬ÕâÐ©×ø±êÖ®¼ä¹¹³ÉһЩÓÐÏòͼ£¬¸ù¾ÝÌâÒ⣬¼ÙÉèÁ½¸öµãa£¨x1 ,y1£© ,b£¨x2 ,y2£© .µ±y1 <= y2ʱ£¬ËûÃÇÖ®¼ä¿ÉÒÔÁ¬Ò»ÌõÓÐÏò±ß£¬¼´a -> b.
    ¾ÍÊÇÿ¸öµãÖ»ÄÜÁ¬y×ø±ê´óÓÚËûµÄµã£¬È»ºó¾Í¹¹³ÉÁËÒ»ÕÅÓÐÏòͼ¡£
    ×îºóÇó³ö×îÉٵľàÀë¿ÉÒÔʹµÃËùÓеĵ㶼Á¬ÆðÀ´¡£
    ¸Õ¿ªÊ¼ÒÔΪֱ½ÓÇó³öÁ½Á½Ö®¼äµÄ¾àÀ룬ȻºóÓÃkruskalÇóÒ»±éMST¾Í¿ÉÒÔÁË¡£µ«ÊÇ×ÐϸÏëÁËһϣ¬ÕâÀïÓÐÏò±ßµÄÏÞÖÆ¾ÍʹµÃһЩÁ¬±ßµÄÇé¿öÊDz»¿ÉÐеġ£
    ÕâµÀÌâµÄÕý½âÊÇ×îСÊ÷ÐÎͼ£¬¶øÇÒÊÇ×îÂãµÄ¡£
    ÒòΪÕâµÀÌâËûµÄ¸ùÊDz»È·¶¨µÄ£¬ÄÇôÎÒÃÇ¿ÉÒÔÓÃÒ»¸ö³¬¼¶Ô´µã£¬×÷ΪËûµÄ¸ù£¬½«ËûºÍËùÓеĵ㶼Á¬ÆðÀ´£¬±ßÊÇinf.
    #include <set>
    #include <map>
    #include <stack>
    #include <cmath>
    #include <queue>
    #include <cstdio>
    #include <string>
    #include <vector>
    #include <iomanip>
    #include <cstring>
    #include <iostream>
    #include <algorithm>
    #define Max 2505
    #define FI first
    #define SE second
    #define ll long long
    #define PI acos£¨-1.0£©
    #define inf 0x3fffffff
    #define LL£¨x£© £¨ x ¡¶ 1 £©
    #define bug puts£¨"here"£©
    #define PII pair<int,int>
    #define RR£¨x£© £¨ x ¡¶ 1 | 1 £©
    #define mp£¨a,b£© make_pair£¨a,b£©
    #define mem£¨a,b£© memset£¨a,b,sizeof£¨a£©£©
    #define REP£¨i,s,t£© for£¨ int i = £¨ s £© ; i <= £¨ t £© ; ++ i £©
    using namespace std;
    inline void RD£¨int &ret£© {
    char c;
    int flag = 1 ;
    do {
    c = getchar£¨£©£»
    if£¨c == '-'£©flag = -1 ;
    } while£¨c < '0' || c > '9'£© ;
    ret = c - '0';
    while£¨£¨c=getchar£¨£©£© >= '0' && c <= '9'£©
    ret = ret * 10 + £¨ c - '0' £©£»
    ret *= flag ;
    }
    inline void OT£¨int a£© {
    if£¨a >= 10£©OT£¨a / 10£© ;
    putchar£¨a % 10 + '0'£© ;
    }
    inline void RD£¨double &ret£© {
    char c ;
    int flag = 1 ;
    do {
    c = getchar£¨£© ;
    if£¨c == '-'£©flag = -1 ;
    } while£¨c < '0' || c > '9'£© ;
    ll n1 = c - '0' ;
    while£¨£¨c = getchar£¨£©£© >= '0' && c <= '9'£© {
    n1 = n1 * 10 + c - '0' ;
    }
    ll n2 = 1 ;
    while£¨£¨c = getchar£¨£©£© >= '0' && c <= '9'£© {
    n1 = n1 * 10 + c - '0' ;
    n2 *= 10 ;
    }
    ret = flag * £¨double£©n1 / £¨double£©£¨n2£© ;
    }
    /*********************************************/
    #define N 1005
    struct PP{
    double x , y ;
    }P[N] ;
    double getdis£¨int i ,int j£©{
    return sqrt£¨£¨P[i].x - P[j].x£© * £¨P[i].x - P[j].x£© + £¨P[i].y - P[j].y£© * £¨P[i].y - P[j].y£©£© ;
    }
    struct kdq{
    int s , e ;
    double l ;
    }ed[N * N] ;
    int num ;
    void add£¨int s ,int e ,double l£©{
    ed[num].s = s ;
    ed[num].e = e ;
    ed[num].l = l ;
    num ++ ;
    }
    void init£¨£©{
    num = 0 ;
    }
    int n ;
    int S ;
    int pre[N] , id[N] , vis[N] ;
    double in[N] ;
    double Directed_MST£¨int root ,int NV , int NE£©{
    double ret = 0 ;
    while£¨1£©{
    for £¨int i = 0 ; i < NV ; i ++ £©in[i] = inf ;

   

Ê×Ò³ ÉÏÒ»Ò³ 1 2 3 4 5 ÏÂÒ»Ò³ βҳ 1/5/5
¡¾´ó ÖРС¡¿¡¾´òÓ¡¡¿ ¡¾·±Ìå¡¿¡¾Í¶¸å¡¿¡¾Êղء¿ ¡¾ÍƼö¡¿¡¾¾Ù±¨¡¿¡¾ÆÀÂÛ¡¿ ¡¾¹Ø±Õ¡¿ ¡¾·µ»Ø¶¥²¿¡¿
·ÖÏíµ½: 
ÉÏһƪ£ºÍõ×ÓÑ¡¹«Ö÷½á»éPOJÎÊÌâ ÏÂһƪ£ºÒ»µÀ×îСÊ÷ÐÎͼµÄ»ù´¡Ìâ

ÆÀÂÛ

ÕÊ¡¡¡¡ºÅ: ÃÜÂë: (ÐÂÓû§×¢²á)
Ñé Ö¤ Âë:
±í¡¡¡¡Çé:
ÄÚ¡¡¡¡ÈÝ:

¡¤Linuxϵͳ¼ò½é (2025-12-25 21:55:25)
¡¤Linux°²×°MySQL¹ý³Ì (2025-12-25 21:55:22)
¡¤Linuxϵͳ°²×°½Ì³Ì£¨ (2025-12-25 21:55:20)
¡¤HTTP Åc HTTPS µÄ²î„ (2025-12-25 21:19:45)
¡¤ÍøÕ¾°²È«±ØÐ޿ΣºÍ¼ (2025-12-25 21:19:42)