3331 unordered_map<string, room> rooms;
3332 unordered_map<char, unordered_set<student *>> levels;
3333 unordered_map<string, unordered_map<string, int>> dates;
3334 for(
int i = 0; i < n; i++) {
3336 cin >> stu->id >> stu->grade;
3337 stu->level = stu->id[0];
3338 stu->room = stu->id.substr(1, 3);
3339 stu->date = stu->id.substr(4, 6);
3340 rooms[stu->room].sum += stu->grade;
3341 rooms[stu->room].count++;
3342 levels[stu->level].insert(stu);
3343 dates[stu->date][stu->room]++;
3345 for(
int i = 0; i < m; i++) {
3348 cout <<
"Case " << i + 1 <<
": " << typ <<
' ';
3353 if(
static_cast<unsigned int>(levels.contains(l)) != 0U) {
3354 vector<student *>
vec;
3355 for(
auto *
const pstu: levels[l]) {
3356 vec.emplace_back(pstu);
3358 sort(
vec.begin(),
vec.end(), p_stu_comp());
3359 for(
auto *stu:
vec) {
3360 cout << stu->id <<
' ' << stu->grade << endl;
3363 cout <<
"NA" << endl;
3365 }
else if(typ == 2) {
3368 cout << room_id << endl;
3369 if(
static_cast<unsigned int>(rooms.contains(room_id)) != 0U) {
3370 cout << rooms[room_id].count <<
' ' << rooms[room_id].sum << endl;
3372 cout <<
"NA" << endl;
3374 }
else if(typ == 3) {
3377 cout << date << endl;
3378 if(dates[date].empty()) {
3379 cout <<
"NA" << endl;
3382 vector<pair<string, int>>
vec;
3383 for(
const auto &room_cnt: dates[date]) {
3384 vec.emplace_back(room_cnt);
3386 sort(
vec.begin(),
vec.end(), room_cnt_comp());
3387 for(
const auto &[
id, cnt]:
vec) {
3388 cout <<
id <<
' ' << cnt << endl;
3393 cout <<
"NA" << endl;
struct acwing::acwing3378::student student