Fzu2192, type and query set

Source: Internet
Author: User

Fzu2192, type and query set

If the meaning of the question is Chinese, it will not be said;

Here the use of types and query set, respectively with 1-N; N-2N, 2N-3N represents the city, service, people;

Pay attention to the following points:

1: Do not use the rank array, because the edge must be controlled by yourself.

2: when using the unite function, compare x and y to control large connections to small ones. In this way, find () it will find the smallest (city), and if it is greater than N, it means that it is not connected to the city, and the output is 0;

 

The Code is as follows:

 

# Include

 
  
# Include

  
   
# Include

   
    
# Include

    
     
# Include

     
      
Using namespace std; const int N = 300000; int par [999999], last [999999]; void init (int n) {int I, j; for (int I = 0; I

      
        N) {printf ("0 \ n"); continue;} printf ("% d \ n", temp) ;}} return 0 ;} 
      

     

    

   

  

 


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.