diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 2992a5b..07e07cd 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,7 @@
-
+
@@ -23,11 +23,18 @@
+
+
+
+
+
+
+
@@ -44,6 +51,7 @@
+
@@ -52,18 +60,26 @@
+
+
+
+
+
+
+
+
@@ -80,7 +96,6 @@
-
@@ -90,23 +105,30 @@
+
+
+
+
+
+
+
@@ -129,6 +151,7 @@
+
@@ -142,6 +165,7 @@
+
@@ -153,29 +177,35 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -210,7 +240,9 @@
+
+
@@ -313,6 +345,23 @@
"CMake 应用程序.cs101__stage_2__dh_13_02_tumor_again.executor": "Run",
"CMake 应用程序.cs101__stage_2__dh_13_05_books.executor": "Run",
"CMake 应用程序.cs101__stage_2__dh_13_06_nums_in_string.executor": "Debug",
+ "CMake 应用程序.cs101__stage_2__dh_14_01_day_of_date.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_14_02_special_location.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_14_03_linear_equations.executor": "Debug",
+ "CMake 应用程序.cs101__stage_2__dh_14_04_eat.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_14_05_flip_words.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_14_06_number_systems.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_15_01_is_abbr.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_15_02_tiny_kmp.executor": "Debug",
+ "CMake 应用程序.cs101__stage_2__dh_15_03_courage_machine.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_15_04_related_months.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_15_05_clinic_queue.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_15_08_matrix_modification.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_16_01_shit_pair_nums.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_16_03_arrange_activities.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_16_05_line_wrap.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_16_07_observer_stone.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_16_08_tianji_horse.executor": "Run",
"CMake 应用程序.dp__TJOI2007_walk_segments_dp.executor": "Run",
"CMake 应用程序.dp__luogu_U434718_eagle_egg.executor": "Run",
"CMake 应用程序.dsa__ch2_linear_list__P2629_good_news.executor": "Run",
@@ -327,6 +376,7 @@
"CMake 应用程序.dsa__ch4_string__dsa_0406_valid_string.executor": "Run",
"CMake 应用程序.dsa__ch4_string__luogu_template_kmp_P3375.executor": "Run",
"CMake 应用程序.dsa__ch5_binary_tree__dsa_0510_reconstruct_tree.executor": "Run",
+ "CMake 应用程序.dsa__ch5_binary_tree__dsa_0514_heap_STL.executor": "Run",
"CMake 应用程序.dsa__ch5_binary_tree__luogu_P4715_matches.executor": "Run",
"CMake 应用程序.dsa__ch5_binary_tree__luogu_T750119_bin_tree_iter.executor": "Run",
"CMake 应用程序.dsa__linear_list__dsa_0201_dictionary.executor": "Run",
@@ -408,12 +458,7 @@
-
-
-
-
-
-
+
@@ -464,6 +509,11 @@
+
+
+
+
+
@@ -494,6 +544,11 @@
+
+
+
+
+
@@ -634,7 +689,7 @@
-
+
@@ -674,6 +729,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -864,6 +1024,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -1157,6 +1327,7 @@
+
@@ -1186,7 +1357,7 @@
-
+
@@ -1194,6 +1365,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1232,6 +1424,8 @@
+
+
@@ -1290,14 +1484,195 @@
"profileIdByStamp": [
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序._others__others_test",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch3_stack_queue__dsa_0301_sliding_window",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch3_stack_queue__dsa_0301_sliding_window",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_15_05_clinic_queue",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch3_stack_queue__dsa_0301_sliding_window_SLOW",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_14_06_number_systems",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_13_02_tumor_again",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_14_04_eat",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch4_string__dsa_0406_valid_string",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_13_01_max_points",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_15_04_related_months",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.luogu_P1160_biodir_linked_list",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch3_stack_queue__dsa_0302_calculator",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch3_stack_queue__USACO12MARs_flowerpot",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_16_08_tianji_horse",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.pojcs101_T27373_biggest_combination_t2",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_14_03_linear_equations",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "Python.dh_04_04_balloons_init1"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch4_string__luogu_template_kmp_P3375",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.dp__TJOI2007_walk_segments_dp",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_15_03_courage_machine",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_16_01_shit_pair_nums",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_15_08_matrix_modification",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_11_03_jump_rope",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_16_07_observer_stone",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序._others__jzh__jzh_c1_h",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.pojcs101_M02746_josephus_problem_simulation",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.NOIP2003J_bigint",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序._others__others_test_cpp",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序._others__others_test",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
@@ -1318,7 +1693,7 @@
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch3_stack_queue__dsa_0301_sliding_window_SLOW",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch5_binary_tree__dsa_0514_heap_STL",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
@@ -1346,14 +1721,7 @@
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_13_02_tumor_again",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch4_string__dsa_0406_valid_string",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_16_03_arrange_activities",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
@@ -1365,20 +1733,6 @@
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_13_01_max_points",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.luogu_P1160_biodir_linked_list",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
{
"first": {
"##RUN_CONFIGURATION##": "CMake 应用程序.NOIP2016J_bay",
@@ -1393,13 +1747,6 @@
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch3_stack_queue__dsa_0302_calculator",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
{
"first": {
"##RUN_CONFIGURATION##": "CMake 应用程序.pojcs101_T27104_chicken_monitors",
@@ -1416,7 +1763,7 @@
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch3_stack_queue__USACO12MARs_flowerpot",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_14_05_flip_words",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
@@ -1428,13 +1775,6 @@
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.pojcs101_T27373_biggest_combination_t2",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
{
"first": {
"##RUN_CONFIGURATION##": "CMake 应用程序.JLOI2009_binary_tree",
@@ -1442,25 +1782,12 @@
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_12_04_day_delta",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
{
"first": {
"##RUN_CONFIGURATION##": "C/C++ 文件.dh_05_05_pair_of_shit_nums_ANALYSIS.cpp"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
- {
- "first": {
- "##RUN_CONFIGURATION##": "Python.dh_04_04_balloons_init1"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
{
"first": {
"##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch2_linear_list__SDOI2007_queue",
@@ -1468,20 +1795,6 @@
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch4_string__luogu_template_kmp_P3375",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.dp__TJOI2007_walk_segments_dp",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
{
"first": {
"##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_13_06_nums_in_string",
@@ -1498,21 +1811,7 @@
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_11_03_jump_rope",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序._others__jzh__jzh_c1_h",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.pojcs101_M02746_josephus_problem_simulation",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_15_01_is_abbr",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
@@ -1526,7 +1825,7 @@
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.NOIP2003J_bigint",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_14_02_special_location",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
@@ -1538,13 +1837,6 @@
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序._others__others_test_cpp",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
{
"first": {
"##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch2_linear_list__P2629_good_news",
@@ -1558,9 +1850,23 @@
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_15_02_tiny_kmp",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
+ },
+ {
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_14_01_day_of_date",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
+ },
+ "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
}
],
- "modificationCount": 239
+ "modificationCount": 273
}]]>
@@ -1601,7 +1907,8 @@
-
+
+
@@ -1706,6 +2013,31 @@
34
+
+ file://$PROJECT_DIR$/cs101/stage_2/dh_14_03_linear_equations.cpp
+ 21
+
+
+
+ file://$PROJECT_DIR$/cs101/stage_2/dh_14_06_number_systems.cpp
+ 52
+
+
+
+ file://$PROJECT_DIR$/cs101/stage_2/dh_15_01_is_abbr.cpp
+ 7
+
+
+
+ file://$PROJECT_DIR$/cs101/stage_2/dh_15_02_tiny_kmp.cpp
+ 46
+
+
+
+ file://$PROJECT_DIR$/cs101/stage_2/dh_16_01_shit_pair_nums.cpp
+ 48
+
+
diff --git a/_others/others_test_cpp.cpp b/_others/others_test_cpp.cpp
index ea880fe..e98f371 100644
--- a/_others/others_test_cpp.cpp
+++ b/_others/others_test_cpp.cpp
@@ -11,7 +11,7 @@ struct Attendee {
int get_max_attendees_amount(std::vector attendees_schedule) {
- std::array bucket{};
+ std::array bucket {};
for (const auto [enter_time, exit_time] : attendees_schedule) {
for (int t = enter_time; t < exit_time; t++) {
bucket[t]++;
@@ -43,6 +43,12 @@ int main() {
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;
}
diff --git a/cs101/2023mid/exam_2023mid_05_mask.cpp b/cs101/2023mid/exam_2023mid_05_mask.cpp
new file mode 100644
index 0000000..c39b027
--- /dev/null
+++ b/cs101/2023mid/exam_2023mid_05_mask.cpp
@@ -0,0 +1,18 @@
+#include
+#include
+
+using GridRow = std::vector;
+using Grid = std::pmr::vector;
+
+int n;
+std::vector> infected, wearing_mask;
+std::vector> infection_flag;
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ std::cin >> n;
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_12_04_day_delta.cpp b/cs101/stage_2/dh_12_04_date_delta.cpp
similarity index 98%
rename from cs101/stage_2/dh_12_04_day_delta.cpp
rename to cs101/stage_2/dh_12_04_date_delta.cpp
index 8cd8096..b6f3050 100644
--- a/cs101/stage_2/dh_12_04_day_delta.cpp
+++ b/cs101/stage_2/dh_12_04_date_delta.cpp
@@ -1,5 +1,4 @@
#include
-#include
constexpr int DAYS_OF_MONTHS[13] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
diff --git a/cs101/stage_2/dh_14_01_day_of_date.cpp b/cs101/stage_2/dh_14_01_day_of_date.cpp
new file mode 100644
index 0000000..de314ff
--- /dev/null
+++ b/cs101/stage_2/dh_14_01_day_of_date.cpp
@@ -0,0 +1,98 @@
+#include
+#include
+#include
+
+constexpr int DAYS_OF_MONTHS[13] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+const std::unordered_map MONTHS_DICT = {
+ {"Jan", 1},
+ {"Feb", 2},
+ {"Mar", 3},
+ {"Apr", 4},
+ {"May", 5},
+ {"Jun", 6},
+ {"Jul", 7},
+ {"Aug", 8},
+ {"Sep", 9},
+ {"Oct", 10},
+ {"Nov", 11},
+ {"Dec", 12},
+};
+const std::unordered_map DAYS_ENG = {
+ {1, "Mon"},
+ {2, "Tue"},
+ {3, "Wed"},
+ {4, "Thu"},
+ {5, "Fri"},
+ {6, "Sat"},
+ {7, "Sun"},
+};
+
+constexpr bool is_leap(int year) {
+ return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
+}
+
+constexpr int get_days_of_month(int year, int month) {
+ if (month == 2) { return is_leap(year) ? 29 : 28; }
+ return DAYS_OF_MONTHS[month];
+}
+
+constexpr int get_days_of_year(int year) {
+ return is_leap(year) ? 366 : 365;
+}
+
+constexpr int calc_passed_days(int year, int month, int day) {
+ int passed_days = 0;
+ for (int m = 1; m < month; m++) {
+ passed_days += get_days_of_month(year, m);
+ }
+ return passed_days + day;
+}
+
+constexpr int calc_remaining_days(int year, int month, int day) {
+ return get_days_of_year(year) - calc_passed_days(year, month, day);
+}
+
+constexpr int calc_days_delta(int year1, int month1, int day1,
+ int year2, int month2, int day2) {
+ int days_delta = 0;
+ if (year1 == year2) {
+ return calc_passed_days(year2, month2, day2) - calc_passed_days(year1, month1, day1);
+ }
+ for (int y = year1 + 1; y < year2; y++) {
+ days_delta += get_days_of_year(y);
+ }
+ return days_delta
+ + calc_remaining_days(year1, month1, day1)
+ + calc_passed_days(year2, month2, day2);
+}
+
+std::tuple parse_date(std::string s) {
+ std::istringstream ss(s);
+ std::string token;
+ int y, m, d;
+ while (std::getline(ss, token, '-')) {
+ if (token.size() == 4) {
+ y = std::stoi(token);
+ } else if (token.size() == 2) {
+ d = std::stoi(token);
+ } else {
+ m = MONTHS_DICT.at(token);
+ }
+ }
+ return std::make_tuple(y, m, d);
+}
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ std::string date_string;
+ std::cin >> date_string;
+ while (std::cin >> date_string) {
+ auto [y, m, d] = parse_date(date_string);
+ int delta = calc_days_delta(1900, 1, 1, y, m, d);
+ std::cout << DAYS_ENG.at(delta % 7 + 1) << '.' << std::endl;
+ }
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_14_02_special_location.cpp b/cs101/stage_2/dh_14_02_special_location.cpp
new file mode 100644
index 0000000..31bcb03
--- /dev/null
+++ b/cs101/stage_2/dh_14_02_special_location.cpp
@@ -0,0 +1,48 @@
+#include
+#include
+#include
+
+constexpr std::size_t GRID_SIZE = 5;
+
+std::array, GRID_SIZE> grid;
+std::array row_max;
+std::array col_min;
+
+void init_maxs() {
+ for (int i = 0; i < GRID_SIZE; i++) {
+ row_max[i] = *std::max_element(grid[i].begin(), grid[i].end());
+ }
+ for (int j = 0; j < GRID_SIZE; j++) {
+ col_min[j] = grid[0][j];
+ for (int i = 1; i < GRID_SIZE; i++) {
+ col_min[j] = std::min(col_min[j], grid[i][j]);
+ }
+ }
+}
+
+void print_ans() {
+ for (int i = 0; i < GRID_SIZE; i++) {
+ for (int j = 0; j < GRID_SIZE; j++) {
+ if (grid[i][j] == row_max[i] && grid[i][j] == col_min[j]) {
+ std::cout << i + 1 << " " << j + 1 << " " << grid[i][j] << std::endl;
+ return;
+ }
+ }
+ }
+ std::cout << "not found" << std::endl;
+}
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ for (int i = 0; i < GRID_SIZE; i++) {
+ for (int j = 0; j < GRID_SIZE; j++) {
+ std::cin >> grid[i][j];
+ }
+ }
+ init_maxs();
+ print_ans();
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_14_03_linear_equations.cpp b/cs101/stage_2/dh_14_03_linear_equations.cpp
new file mode 100644
index 0000000..351bb71
--- /dev/null
+++ b/cs101/stage_2/dh_14_03_linear_equations.cpp
@@ -0,0 +1,69 @@
+#include
+#include
+#include
+
+using RopeData = std::pair;
+
+constexpr std::size_t N = 5;
+int max_height;
+std::array rope_counts{};
+
+
+void print_solution() {
+ std::array rope_lengths{};
+ for (int i = 0; i < N; i++) {
+ rope_lengths[i].first = rope_counts[i].first;
+ }
+ for (int height = 1; height <= max_height; height++) {
+ for (rope_lengths[0].second = 0;
+ rope_lengths[0].second < height / rope_counts[0].second;
+ rope_lengths[0].second++) {
+ if (height == 721 && rope_lengths[0].second == 265) {
+ std::clog << height << ' ' << rope_lengths[0].second << std::endl;
+ }
+
+ bool is_valid = true;
+ for (int i = 1; i < N; i++) {
+ rope_lengths[i].second = height - rope_lengths[i - 1].second * rope_counts[i - 1].second;
+ if (rope_lengths[i].second <= 0 || rope_lengths[i].second == rope_lengths[i - 1].second) {
+ is_valid = false;
+ break;
+ }
+ }
+
+ if (height - rope_lengths[N - 1].second * rope_counts[N - 1].second != rope_lengths[0].second) {
+ is_valid = false;
+ }
+ if (is_valid) {
+ // std::sort(rope_lengths.begin(), rope_lengths.end(), std::greater<>());
+ std::cout << height;
+ for (const auto& rope : rope_lengths) {
+ std::cout << ' ' << rope.second;
+ }
+ std::cout << std::endl;
+ return;
+ }
+ }
+ }
+ std::cout << "not found" << std::endl;
+}
+
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ std::cin >> max_height;
+ max_height *= 100;
+
+ for (int i = 0; i < N; i++) {
+ rope_counts[i].first = i;
+ std::cin >> rope_counts[i].second;
+ }
+
+ // std::sort(rope_counts.begin(), rope_counts.end(), std::greater<>());
+ print_solution();
+
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_14_03_linear_equations_COMPLICATED.cpp b/cs101/stage_2/dh_14_03_linear_equations_COMPLICATED.cpp
new file mode 100644
index 0000000..8759289
--- /dev/null
+++ b/cs101/stage_2/dh_14_03_linear_equations_COMPLICATED.cpp
@@ -0,0 +1,63 @@
+#include
+#include
+
+constexpr std::size_t ORDER = 5;
+
+std::array, ORDER> matrix;
+
+std::ostream& operator<<(std::ostream& os, const std::array& row) {
+ for (int i = 0; i < ORDER; i++) {
+ os << row[i] << " ";
+ }
+ os << std::endl;
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os, const std::array, ORDER>& matrix) {
+ for (const auto& row : matrix) {
+ os << row;
+ }
+ return os;
+}
+
+void simplify_matrix() {
+ for (int i = 1; i < ORDER; i++) {
+ for (int j = i; j < ORDER; j++) {
+ if (matrix[j][i - 1] != 0) {
+ int temp = matrix[j][i - 1];
+ for (int k = 0; k < ORDER; k++) {
+ matrix[j][k] = matrix[j][k] * matrix[i - 1][i - 1] - matrix[i - 1][k] * temp;
+ }
+ }
+ std::clog << matrix << std::endl;
+ }
+ }
+}
+
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ int max_height;
+ std::array values{};
+ std::cin >> max_height;
+ max_height *= 100;
+
+ for (int i = 0; i < ORDER; i++) {
+ std::cin >> values[i];
+ }
+ for (int i = 0; i < ORDER; i++) {
+ matrix[i][i] = values[i];
+ matrix[i][(i + 1) % ORDER] = 1 - values[(i + 1) % ORDER];
+ matrix[i][(i + 2) % ORDER] = -1;
+ }
+ std::clog << matrix << std::endl;
+
+ simplify_matrix();
+
+ std::clog << matrix << std::endl;
+
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_14_04_eat.cpp b/cs101/stage_2/dh_14_04_eat.cpp
new file mode 100644
index 0000000..1fc031d
--- /dev/null
+++ b/cs101/stage_2/dh_14_04_eat.cpp
@@ -0,0 +1,26 @@
+#include
+#include
+
+using Person = char;
+using Order = std::string;
+
+bool judge(Order order, Person a, Person b) {
+ return order.find(a) < order.find(b);
+}
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ for (auto order : {"ABC", "ACB", "BAC", "BCA", "CAB", "CBA"}) {
+ std::array judges{};
+ judges[0] = judge(order, 'A', 'B');
+ judges[1] = judge(order, 'B', 'A') + judge(order, 'C', 'A');
+ judges[2] = judge(order, 'B', 'C') + judge(order, 'A', 'B');
+ if (judges[order[0] - 'A'] > judges[order[1] - 'A'] &&
+ judges[order[1] - 'A'] > judges[order[2] - 'A']) {
+ std::cout << order << std::endl;
+ }
+ }
+ return 0;
+}
diff --git a/cs101/stage_2/dh_14_05_flip_words.cpp b/cs101/stage_2/dh_14_05_flip_words.cpp
new file mode 100644
index 0000000..911a27a
--- /dev/null
+++ b/cs101/stage_2/dh_14_05_flip_words.cpp
@@ -0,0 +1,23 @@
+#include
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ std::string line;
+ std::getline(std::cin, line);
+ line += ' ';
+
+ for (int i = 0; i < line.size(); i++) {
+ if (line[i] == ' ') {
+ for (int j = i - 1; j >= 0 && line[j] != ' '; j--) {
+ std::cout << line[j];
+ }
+ if (i != line.size() - 1) {
+ std::cout << line[i];
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_14_06_number_systems.cpp b/cs101/stage_2/dh_14_06_number_systems.cpp
new file mode 100644
index 0000000..9890e51
--- /dev/null
+++ b/cs101/stage_2/dh_14_06_number_systems.cpp
@@ -0,0 +1,60 @@
+#include
+#include
+
+using BasedNumber = std::string;
+
+constexpr short char_to_digit(const char c) {
+ if (c >= '0' && c <= '9') {
+ return c - '0';
+ }
+ if (c >= 'a' && c <= 'f') {
+ return c - 'a' + 10;
+ }
+ return -1;
+}
+
+constexpr char digit_to_char(const short d) {
+ if (d >= 0 && d <= 9) {
+ return static_cast('0' + d);
+ }
+ if (d >= 10 && d <= 15) {
+ return static_cast('a' + d - 10);
+ }
+ return '?';
+}
+
+unsigned long long based_to_dec(BasedNumber based_number, unsigned short base) {
+ unsigned long long dec = 0;
+ for (int i = 0; i < based_number.size(); i++) {
+ dec *= base;
+ dec += char_to_digit(based_number[i]);
+ }
+ return dec;
+}
+
+BasedNumber dec_to_based(unsigned long long dec, unsigned short base) {
+ BasedNumber based_number;
+ while (dec > 0) {
+ based_number.push_back(digit_to_char(dec % base));
+ dec /= base;
+ }
+ std::reverse(based_number.begin(), based_number.end());
+ return based_number;
+}
+
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+ std::string num1, num2;
+ unsigned short base1, base2, base3;
+ std::cin >> base1 >> num1 >> base2 >> num2 >> base3;
+
+ unsigned long long dec1 = based_to_dec(num1, base1);
+ unsigned long long dec2 = based_to_dec(num2, base2);
+ unsigned long long dec3 = dec1 + dec2;
+ std::clog << dec1 << " " << dec2 << " " << dec3 << std::endl;
+ std::cout << dec_to_based(dec3, base3) << std::endl;
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_15_01_is_abbr.cpp b/cs101/stage_2/dh_15_01_is_abbr.cpp
new file mode 100644
index 0000000..822e3e2
--- /dev/null
+++ b/cs101/stage_2/dh_15_01_is_abbr.cpp
@@ -0,0 +1,32 @@
+#include
+#include
+
+bool is_abbr(std::string target, std::string original) {
+ if (target.size() >= original.size()) { return false; }
+ int i = 0, j = 0;
+ for (; i < target.size() && j < original.size(); j++) {
+ if (target[i] == original[j]) { i++; }
+ }
+ if (i == target.size()) { return true; }
+ return false;
+}
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ std::string temp;
+ std::getline(std::cin, temp);
+ int n = std::stoi(temp);
+
+ for (int _ = 0; _ < n; _++) {
+ std::string target, original;
+ std::getline(std::cin, temp);
+ std::istringstream ss(temp);
+ std::getline(ss, target, ':');
+ std::getline(ss, original);
+ std::cout << (is_abbr(target, original) ? "YES" : "NO") << std::endl;
+ }
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_15_02_tiny_kmp.cpp b/cs101/stage_2/dh_15_02_tiny_kmp.cpp
new file mode 100644
index 0000000..60160c6
--- /dev/null
+++ b/cs101/stage_2/dh_15_02_tiny_kmp.cpp
@@ -0,0 +1,55 @@
+#include
+#include
+#include
+
+std::vector prefix_function(const std::string& s) {
+ std::vector pi(s.size());
+ for (int i = 1; i < s.size(); i++) {
+ int j = pi[i - 1];
+ while (j > 0 && s[i] != s[j]) {
+ j = pi[j - 1];
+ }
+ if (s[i] == s[j]) { j++; }
+ pi[i] = j;
+ }
+ return pi;
+}
+
+std::vector find_substr_pos(const std::string& s, const std::string& subs) {
+ std::string concat_string = subs + '\0' + s;
+ auto pi = prefix_function(concat_string);
+ std::vector positions;
+ for (int i = subs.size(); i < concat_string.size(); i++) {
+ if (pi[i] == subs.size()) { positions.push_back(i - 2 * subs.size()); }
+ }
+ return positions;
+}
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ std::string line;
+ std::string s, subs1, subs2;
+
+ while (std::getline(std::cin, line)) {
+ std::istringstream iss(line);
+ std::getline(iss, s, ',');
+ std::getline(iss, subs1, ',');
+ std::getline(iss, subs2, ',');
+ auto subs1_pos = find_substr_pos(s, subs1), subs2_pos = find_substr_pos(s, subs2);
+ if (subs1.empty() || subs2.empty()) {
+ std::cout << -1 << std::endl;
+ continue;
+ }
+ auto start_pos = subs1_pos[0] + subs1.size();
+ auto end_pos = subs2_pos[subs2_pos.size() - 1];
+ if (start_pos > end_pos) {
+ std::cout << -1 << std::endl;
+ } else {
+ std::cout << end_pos - start_pos << std::endl;
+ }
+ }
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_15_03_courage_machine.cpp b/cs101/stage_2/dh_15_03_courage_machine.cpp
new file mode 100644
index 0000000..e26c00c
--- /dev/null
+++ b/cs101/stage_2/dh_15_03_courage_machine.cpp
@@ -0,0 +1,28 @@
+#include
+#include
+
+std::string calc_sequence(int n) {
+ std::string sequence;
+ while (n) {
+ if (n % 2) {
+ sequence += 'N';
+ n = (n - 1) / 2;
+ } else {
+ sequence += 'G';
+ n = (n - 2) / 2;
+ }
+ }
+ std::reverse(sequence.begin(), sequence.end());
+ return sequence;
+}
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ int n;
+ std::cin >> n;
+ std::cout << calc_sequence(n) << std::endl;
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_15_04_related_months.cpp b/cs101/stage_2/dh_15_04_related_months.cpp
new file mode 100644
index 0000000..d2aaaac
--- /dev/null
+++ b/cs101/stage_2/dh_15_04_related_months.cpp
@@ -0,0 +1,49 @@
+#include
+
+constexpr bool is_leap(int year) {
+ if (year % 40000 == 0) { return false; }
+ if (year % 10000 == 0) { return false; }
+ if (year % 400 == 0) { return true; }
+ if (year % 100 == 0) { return false; }
+ return year % 4 == 0;
+}
+
+constexpr int get_days_in_month(int year, int month) {
+ switch (month) {
+ case 1: return 31;
+ case 2: return is_leap(year) ? 29 : 28;
+ case 3: return 31;
+ case 4: return 30;
+ case 5: return 31;
+ case 6: return 30;
+ case 7: return 31;
+ case 8: return 31;
+ case 9: return 30;
+ case 10: return 31;
+ case 11: return 30;
+ case 12: return 31;
+ default: throw std::invalid_argument("Invalid month");
+ }
+}
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ int n;
+ std::cin >> n;
+ for (int _ = 0; _ < n; _++) {
+ int year, month1, month2;
+ std::cin >> year >> month1 >> month2;
+ if (month1 > month2) {
+ std::swap(month1, month2);
+ }
+ int days = 0;
+ for (int m = month1; m < month2; m++) {
+ days += get_days_in_month(year, m);
+ }
+ std::cout << (days % 7 == 0 ? "YES" : "NO") << std::endl;
+ }
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_15_05_clinic_queue.cpp b/cs101/stage_2/dh_15_05_clinic_queue.cpp
new file mode 100644
index 0000000..9fae2da
--- /dev/null
+++ b/cs101/stage_2/dh_15_05_clinic_queue.cpp
@@ -0,0 +1,48 @@
+#include
+#include
+#include
+#include
+#include
+
+template
+struct ElemWithIndex {
+ T value;
+ std::size_t idx;
+ bool operator<(ElemWithIndex other) const { return value < other.value; }
+ auto operator+(ElemWithIndex other) -> decltype(value + value) { return value + other.value; }
+};
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ int n;
+ std::cin >> n;
+
+ std::vector> times(n);
+ for (int i = 0; i < n; ++i) {
+ times[i].idx = i + 1;
+ std::cin >> times[i].value;
+ }
+ std::stable_sort(times.begin(), times.end());
+
+ bool first = true;
+ for (auto& [_, idx] : times) {
+ if (!first) { std::cout << " "; }
+ std::cout << idx;
+ first = false;
+ }
+
+ std::vector wait_times(times.size());
+
+ for (int i = 1; i < times.size(); i++) {
+ wait_times[i] = wait_times[i - 1] + times[i - 1].value;
+ }
+
+ int sum = std::accumulate(wait_times.begin(), wait_times.end(), 0);
+
+ std::cout << std::endl << std::fixed << std::setprecision(2) << 1.0 * sum / times.size() << std::endl;
+
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_15_06_pass_balls.cpp b/cs101/stage_2/dh_15_06_pass_balls.cpp
new file mode 100644
index 0000000..f9baced
--- /dev/null
+++ b/cs101/stage_2/dh_15_06_pass_balls.cpp
@@ -0,0 +1,20 @@
+#include
+#include
+
+int calc_max_ans(int n) {
+ for (int i = n / 2; i >= 1; i--) {
+ if (std::gcd(i, n) == 1) { return i; }
+ }
+ __builtin_unreachable();
+}
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ int n;
+ std::cin >> n;
+ std::cout << calc_max_ans(n) << std::endl;
+
+ return 0;
+}
diff --git a/cs101/stage_2/dh_15_07_char_stat.cpp b/cs101/stage_2/dh_15_07_char_stat.cpp
new file mode 100644
index 0000000..5d0bc5b
--- /dev/null
+++ b/cs101/stage_2/dh_15_07_char_stat.cpp
@@ -0,0 +1,35 @@
+#include
+#include
+#include