#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)