开始计概A下半学期。
This commit is contained in:
1 parent
0cfdc8499c
commit
38e97654e1
31 files changed
+2144
-110
No files matched your search
+41
-43
@@ -1,54 +1,52 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include<bits/stdc++.h>
|
||||
using namespace std;
|
||||
|
||||
constexpr int MAX_N = 1001, MAX_T = 1001;
|
||||
|
||||
struct Attendee {
|
||||
int enter_time = 0, exit_time = 0;
|
||||
struct patient {
|
||||
string id;
|
||||
int year;
|
||||
};
|
||||
|
||||
|
||||
int get_max_attendees_amount(std::vector<Attendee> attendees_schedule) {
|
||||
std::array<int, MAX_T> bucket {};
|
||||
for (const auto [enter_time, exit_time] : attendees_schedule) {
|
||||
for (int t = enter_time; t < exit_time; t++) {
|
||||
bucket[t]++;
|
||||
}
|
||||
}
|
||||
return *std::max_element(bucket.begin(), bucket.end());
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
std::iostream::sync_with_stdio(false);
|
||||
std::cin.tie(nullptr);
|
||||
int n;
|
||||
cin >> n;
|
||||
|
||||
std::vector<Attendee> attendees;
|
||||
char temp_comma;
|
||||
int x;
|
||||
while (true) {
|
||||
std::cin >> x >> temp_comma;
|
||||
attendees.push_back({x, -1});
|
||||
if (temp_comma != ',') {
|
||||
std::cin.unget();
|
||||
break;
|
||||
}
|
||||
int num = 0, cnt = 0;
|
||||
patient p[n];
|
||||
patient x[n];
|
||||
string young[n];
|
||||
for (int i = 0; i < n; i++) {
|
||||
cin >> p[i].id >> p[i].year;
|
||||
x[i].id = p[i].id;
|
||||
x[i].year = p[i].year;
|
||||
}
|
||||
for (int i = 0; i < attendees.size() - 1; i++) {
|
||||
std::cin >> attendees[i].exit_time >> temp_comma;
|
||||
}
|
||||
std::cin >> attendees[attendees.size() - 1].exit_time;
|
||||
|
||||
std::cout << attendees.size() << ' ' << get_max_attendees_amount(attendees) << std::endl;
|
||||
|
||||
int x = 6, ans = 0;
|
||||
if (x > 5)
|
||||
if (x > 10) ans = 1;
|
||||
for (int j = 0; j < n; j++) {
|
||||
if (p[j].year >= 60)
|
||||
num++;
|
||||
else
|
||||
ans = 2;
|
||||
std::cout << ans;
|
||||
young[cnt] = p[j].id;
|
||||
cnt++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < n - 1; i++)
|
||||
for (int j = 0; j < n - 1 - i; j++) {
|
||||
int temp_year;
|
||||
string temp_id;
|
||||
if (x[j].year < x[j + 1].year) {
|
||||
temp_year = x[j].year;
|
||||
temp_id = x[j].id;
|
||||
x[j].year = x[j + 1].year;
|
||||
x[j].id = x[j + 1].id;
|
||||
x[j + 1].year = temp_year;
|
||||
x[j + 1].id = temp_id;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
cout << x[i].id << endl;
|
||||
}
|
||||
for (int j = 0; j < cnt; j++) {
|
||||
cout << young[j] << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user