pat:1039. Course List for Student (25) section correct (last Big data error)

Source: Internet
Author: User

#include<stdio.h>#include<string.h>#include<vector>#include<algorithm>Usingnamespace Std;Constint max=40010;Constint h=26*26*26*+10;int n,k;n Individual, K-gate class vector<Int> Har[h];int GetID (Char str[])Gets the hash id{for the nameint id=0;Forint i=0; i<5} ++i) {id=id*26+str[i]+' 0 '; } id+=str[3]+' 0 ';return ID;}int main () {scanf ("%d%d", &n,&k);Forint i=1; I<=k; ++i) {int course=0,people=0; scanf"%d%d", &course,&people);Forint j=0; J<people; ++J) {Char name[5]; scanf"%s", name);int Id=getid (name); Har[id].push_back (course); } }Forint i=0; i<n; ++i) {char name[5]; scanf ( "%s", name); int Id=getid (name); sort (Har[id].begin (), Har[id].end ()); printf (  "%s%d" Name,har[id " . Size ()); for (int j=0; j "%d" Har[id] [j]); printf ( "\n");} return 0;}          

pat:1039. Course List for Student (25) partially correct (last big data error)

Related Article

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.