Files
exercises/_others/others_test_cpp.cpp
T

55 lines
1.2 KiB
C++

#include <algorithm>
#include <array>
#include <iostream>
#include <vector>
constexpr int MAX_N = 1001, MAX_T = 1001;
struct Attendee {
int enter_time = 0, exit_time = 0;
};
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);
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;
}
}
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;
else
ans = 2;
std::cout << ans;
return 0;
}