设为首页 加入收藏

TOP

hdu 1558 Segment set
2015-11-21 01:01:26 来源: 作者: 【 】 浏览:1
Tags:hdu 1558 Segment set
#include 
   
     #include 
    
      #include 
     
       #include 
      
        #include 
       
         #include 
        
          #include 
         
           #include 
          
            #include
            #include 
            
              #include 
             
               #include 
              
                #include 
               
                 using namespace std; int tot,bin[1024],cnt[1024]; void init() { for(int i=0; i<1024; i++) { bin[i]=i; cnt[i]=1; } tot=1; } int _find(int x) { while(bin[x]!=x) x=bin[x]; return x; } int main() { int T,m,i,j,t,k; double x1[2024],x2[2024],y1[2024],y2[2024]; char cmd[10]; scanf("%d",&T); while(T--) { init(); scanf("%d",&m); for(k=0; k
                
                 =0&&t2>=0) { if(a>b) { bin[a]=b; cnt[b]+=cnt[a]; } else { bin[b]=a; cnt[a]+=cnt[b]; } } } tot++; } else if(cmd[0]=='Q') { scanf("%d",&t); printf("%d\n",cnt[_find(t)]); } } if(T) printf("\n"); } return 0; } 
                
               
              
             
            
          
         
        
       
      
     
    
   
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Codeforces Round #303 (Div. 2) 下一篇const,enum,inline替换#define

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: