uuu
2026-03-21 17:32:27
发布于:浙江
#include<bits/stdc++.h>
using namespace std;
struct Employee {
int id;
string job_num;
string dept;
int late_count;
};
bool cmp(const Employee &a, const Employee &b) {
return a.id < b.id;
}
int main() {
int n, m;
cin >> n >> m;
vector<Employee> employees(n);
for (int i = 0; i < n; ++i) {
cin >> employees[i].id >> employees[i].job_num >> employees[i].dept;
employees[i].late_count = 0;
}
for (int i = 0; i < m; ++i) {
int a, b;
cin >> a >> b;
for (auto &emp : employees) {
if (emp.id == a) {
if (b > 9) {
emp.late_count++;
}
break;
}
}
}
sort(employees.begin(), employees.end(), cmp);
for (const auto &emp : employees) {
cout << emp.id << " " << emp.job_num << " " << emp.dept << " " << emp.late_count << endl;
}
return 0;
}
这里空空如也













有帮助,赞一个