Title Link: https://pintia.cn/problem-sets/994805342720868352/problems/994805447855292416
The way to open the hash is what I learned from other people's blog, but also the first time, it feels good to use, the next time you meet this topic has a train of thought.
Then inside Sync_with_stdio (false) and the following sentence is to speed up the input and output, this is C + + compatible C input and output, but in the test, OJ will report a section error, I tested, only these two words will still error, before I have used such statements, No error, why is it here?
The code is as follows:
1#include <iostream>2#include <vector>3#include <stdio.h>4#include <fstream>5#include <algorithm>6#include <cstdlib>7 using namespacestd;8 Const intMAXN = -* -* -+Ten;9 intTransCharname[]) {Ten intRET =0; One for(inti =0; I <3; i++){ ARET = ret* -+name[0]-'A'; - } -RET + = name[3]-'0'; the returnret; - } -vector<int>V[MAXN]; - intMain () { + //Ios::sync_with_stdio (false); - //cin.tie (0); + intn,m,k,l; A intstem; at Charname[5]; -CIN >> N >>m; - for(inti =0; I < m; i++){ -Cin >> K >>l; - for(intj =0; J < L; J + +){ -scanf"%s", name); in //cin >> name; -Stem =Trans (name); to V[stem].push_back (k); + //cout << stem << endl; - } the } *vector<int>:: iterator it; $ for(inti =0; I < n; i++){Panax Notoginsengscanf"%s", name); - //cin >> name; theStem =Trans (name); +cout << name <<" "<<v[stem].size (); A sort (V[stem].begin (), V[stem].end ()); the for(it = V[stem].begin (); It! = V[stem].end (); it++){ +cout <<" "<< *it; - } $cout <<Endl; $ } - return 0; -}
1039 Course List for Student