Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses. Input Specification: Each input file contains one test case. For each case, the first line contains ...
course[courseID].push_back(i);//将学生i加入第courseID门课中 } } //输出操作 for(inti=1;i<=k;i++){ printf("%d %d\n",i,course[i].size());//第i门课的学生数 sort(course[i].begin() ,course[i].end(),cmp);//对第i门课的学生排序 for(intj=0;j<course[i].size() ;j++){...
Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses. Input Specification: Each input file contains one test case. For each case, the first line contains ...
Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses.Input Specification:Each input file contains one test case. For each case, the first line contains 2...
For each test case, print the student name lists of all the courses in increasing order of the course numbers. For each course, first print in one line the course number and the number of registered students, separated by a space. Then output the students' names in alphabetical order. Each...
For each test case, print the student name lists of all the courses in increasing order of the course numbers. For each course, first print in one line the course number and the number of registered students, separated by a space. Then output the students' names in alphabetical order. Each...
(i);//将学生i加入第courseID门课中}}//输出操作for(inti=1;i<=k;i++){printf("%d %d\n",i,course[i].size());//第i门课的学生数sort(course[i].begin(),course[i].end(),cmp);//对第i门课的学生排序for(intj=0;j<course[i].size();j++){printf("%s\n",name[course[i][j]])...
3、对每一门课,将course[i]中的学生按姓名字典序从小到大排序,然后输出所要结果 learn && wrong: 1、使用string,最后一组数据容易超时,在这种数据量大的时候,最后使用char数组 2、vector来存放每门课程的选课学生的编号,可以有效防止所有学生选了所有课程的极端情况导致得空间超限 ...
#include<iostream>#include<cstring>#include<vector>#include<algorithm>usingnamespacestd;constintmaxn=4e4+10;vector<int>course[2510];charname[maxn][10];intn,k,c;boolcomp(inta,intb){returnstrcmp(name[a],name[b])<0;}intmain(){scanf("%d%d",&n,&k);for(inti=0;i<n;i++){scanf("...
For each test case, print the student name lists of all the courses in increasing order of the course numbers. For each course, first print in one line the course number and the number of registered students, separated by a space. Then output the students’ names in alphabetical order. Eac...