Hdu 1285 determines the competition ranking (topological sorting)

Source: Internet
Author: User

Hdu 1285 determines the competition ranking (topological sorting)
Determine competition rankingsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)

Total Submission (s): 12152 Accepted Submission (s): 4840

The topological sorting template uses the inbound value (the end point of each edge is called the inbound value, indicating the number of times the vertex serves as the end point of the edge) to determine the position of each contestant.


# Include
 
  
# Include
  
   
Using namespace std; int team [505], len [505], child [505] [505]; // team records two child records (contestant ranking) int main () {int a, B, n, m, I, count, min; while (~ Scanf ("% d", & n, & m) {count = 0; for (I = 1; I <= n; I ++) // initialize {team [I] = 0; len [I] = 0;} while (m --) {scanf ("% d", &, & B); team [B] ++; child [a] [len [a] ++] = B; // build the contact between each vertex} while (count! = N) {if (count) printf (""); min = 501; for (I = 1; I <= n; I ++) // find a point with zero entry/exit (0 indicates that the contestant has not lost) {if (team [I] = 0 & I
   
    


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.