Compare commits
1
Commits
a7a78fbac8
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d30e847c1 |
Generated
-1
@@ -255,7 +255,6 @@
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/EMPTY_BLOCK_STYLE/@EntryValue" value="TOGETHER_SAME_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/EXPORT_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
|
||||
Generated
+229
-122
@@ -21,15 +21,16 @@
|
||||
<component name="CMakeRunConfigurationManager">
|
||||
<generated>
|
||||
<config projectName="exercises" targetName="pojcs101_M02692_12_coins" />
|
||||
<config projectName="exercises" targetName="graph__ECNA2001_sort_letters" />
|
||||
<config projectName="exercises" targetName="pojcs101_T12559_biggest_smallest_combination" />
|
||||
<config projectName="exercises" targetName="pojcs101_T12559_biggest_smallest_combination_WRONG" />
|
||||
<config projectName="exercises" targetName="pojcs101_E02883" />
|
||||
<config projectName="exercises" targetName="pojcs101_M02694_polish_notation_tree" />
|
||||
<config projectName="exercises" targetName="noip2012s_kings_game" />
|
||||
<config projectName="exercises" targetName="pojcs101_M01017_6_boxes" />
|
||||
<config projectName="exercises" targetName="dp__backpack_dp__NOIP2005J_herbs_dp_knapsack_MWASTE" />
|
||||
<config projectName="exercises" targetName="dp__backpack_dp__NOIP2006S_jinming_budget_dp_knapsack" />
|
||||
<config projectName="exercises" targetName="dp__backpack_dp__NOIP2005J_herbs_dp_knapsack_PINGPONG" />
|
||||
<config projectName="exercises" targetName="JLOI2009_binary_tree_GIVEUP" />
|
||||
<config projectName="exercises" targetName="_others__qyz__gdbh" />
|
||||
<config projectName="exercises" targetName="pojcs101_M03704_brackets" />
|
||||
<config projectName="exercises" targetName="luogu_ez_B3628" />
|
||||
@@ -39,13 +40,16 @@
|
||||
<config projectName="exercises" targetName="pojcs101_M02692_12_coins_WRONG" />
|
||||
<config projectName="exercises" targetName="pojcs101_M02746_josephus_problem_simulation" />
|
||||
<config projectName="exercises" targetName="pojcs101_M02039_snakey_encryption" />
|
||||
<config projectName="exercises" targetName="graph__luogu_P3916_graph_iteration" />
|
||||
<config projectName="exercises" targetName="dp__NOIP1996S_miner_dp_MWASTE" />
|
||||
<config projectName="exercises" targetName="pojcs101_T01011_sticks" />
|
||||
<config projectName="exercises" targetName="pojcs101_M02431_cows_gas_leak_WRONG" />
|
||||
<config projectName="exercises" targetName="NOIP2003J_bigint" />
|
||||
<config projectName="exercises" targetName="pojcs101_M01922_ride_follower" />
|
||||
<config projectName="exercises" targetName="luogu_template_dsu_P3367" />
|
||||
<config projectName="exercises" targetName="luogu_P1160_biodir_linked_list" />
|
||||
<config projectName="exercises" targetName="pojcs101_E01003" />
|
||||
<config projectName="exercises" targetName="JLOI2009_binary_tree" />
|
||||
<config projectName="exercises" targetName="pojcs101_M03532" />
|
||||
<config projectName="exercises" targetName="pojcs101_M01321_chest_grid" />
|
||||
<config projectName="exercises" targetName="pojcs101_T04117_split_int" />
|
||||
@@ -60,10 +64,13 @@
|
||||
<config projectName="exercises" targetName="dp__SHOI2002_ski_dp" />
|
||||
<config projectName="exercises" targetName="pojcs101_T01011_sticks_WRONG" />
|
||||
<config projectName="exercises" targetName="pojcs101_M01852_ants_falling" />
|
||||
<config projectName="exercises" targetName="graph__luogu_P3916_graph_iteration_WRONG" />
|
||||
<config projectName="exercises" targetName="SHOI2002_ski_WRONG" />
|
||||
<config projectName="exercises" targetName="dsa__linear_list__dsa_0201_dictionary" />
|
||||
<config projectName="exercises" targetName="pojcs101_T27104_chicken_monitors" />
|
||||
<config projectName="exercises" targetName="dp__backpack_dp__NOIP2005J_herbs_dp_knapsack_MWASTE_BETTER" />
|
||||
<config projectName="exercises" targetName="cmake-build-debug-gcc__CMakeFiles__4.3.1__CompilerIdCXX__CMakeCXXCompilerId" />
|
||||
<config projectName="exercises" targetName="NOIP2016J_bay" />
|
||||
<config projectName="exercises" targetName="lc_135_candy" />
|
||||
<config projectName="exercises" targetName="pojcs101_T27373_biggest_combination_t2" />
|
||||
<config projectName="exercises" targetName="_others__qyz__test" />
|
||||
@@ -75,30 +82,21 @@
|
||||
<configurations />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="4491295e-723c-4e0b-b7b4-9be1cbde5db8" name="更改" comment="1">
|
||||
<change afterPath="$PROJECT_DIR$/NOIP2003J_bigint.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/_others/qyz/gdbh.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/_others/qyz/test.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/dp/NOIP1996S_miner_dp.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/dp/NOIP1996S_miner_dp_MWASTE.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/dp/SHOI2002_ski_dp.cpp" afterDir="false" />
|
||||
<list default="true" id="4491295e-723c-4e0b-b7b4-9be1cbde5db8" name="更改" comment="Update CMakeLists.txt">
|
||||
<change afterPath="$PROJECT_DIR$/JLOI2009_binary_tree_GIVEUP.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/NOIP2016J_bay.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/dp/TJOI2007_walk_segments_dp.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/dp/backpack_dp/NOIP2005J_herbs_dp_knapsack.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/dp/backpack_dp/NOIP2005J_herbs_dp_knapsack_MWASTE.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/dp/backpack_dp/NOIP2005J_herbs_dp_knapsack_MWASTE_BETTER.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/dp/backpack_dp/NOIP2005J_herbs_dp_knapsack_PINGPONG.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/dp/backpack_dp/NOIP2006S_jinming_budget_dp_knapsack.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/pojcs101_T04117_split_int.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/pojcs101_T12559_biggest_smallest_combination.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/pojcs101_T12559_biggest_smallest_combination_WRONG.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/pojcs101_T27104_chicken_monitors.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/pojcs101_T27373_biggest_combination_t2.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/pojcs101_T27373_biggest_combination_t2_TLE.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/dsa/linear_list/dsa_0201_dictionary.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/dsa/linear_list/dsa_0202_card_stacking.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/graph/ECNA2001_sort_letters.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/graph/luogu_P3916_graph_iteration.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/graph/luogu_P3916_graph_iteration_WRONG.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/luogu_P1160_biodir_linked_list.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/practice_of_programming/pp_practise202610a_01.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/editor.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/editor.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pojcs101_M01088_ski.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/SHOI2002_ski.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pojcs101_M01088_ski_WRONG.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/SHOI2002_ski_WRONG.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/dp/backpack_dp/NOIP2006S_jinming_budget_dp_knapsack.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/dp/backpack_dp/NOIP2006S_jinming_budget_dp_knapsack.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/noip2012s_kings_game.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/JLOI2009_binary_tree.cpp" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -154,93 +152,97 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"C/C++ 文件.D_pojcs101_M02692.cpp.executor": "Run",
|
||||
"C/C++ 文件.luogu_UVA755.cpp.executor": "Run",
|
||||
"C/C++ 文件.luogu_ez_B3628.cpp.executor": "Run",
|
||||
"C/C++ 文件.luogu_model_dsu_P3367.cpp.executor": "Run",
|
||||
"C/C++ 文件.noip2003j_bigint.cpp.executor": "Run",
|
||||
"C/C++ 文件.ojcs101_E01003.cpp.executor": "Run",
|
||||
"C/C++ 文件.ojcs101_E01218.cpp.executor": "Run",
|
||||
"C/C++ 文件.ojcs101_E02883.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M01017_6_boxes.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M01088_ski.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M01321_chest_grid.cpp.executor": "Debug",
|
||||
"C/C++ 文件.pojcs101_M01328_radar_greedy.cpp.executor": "Debug",
|
||||
"C/C++ 文件.pojcs101_M01852_ants_falling.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M01922_ride_follower.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M02039_snakey_encryption.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M02431_cows_gas_leak.cpp.executor": "Debug",
|
||||
"C/C++ 文件.pojcs101_M02524_ubiquitous_religions_dsu.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M02692.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M02692_12_coins.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M02694_polish_notation_tree.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M03247_palindromic_prime.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M03441_sum_zero.cpp.executor": "Run",
|
||||
"CMake 应用程序.NOIP2005J_herbs_dp_backpack.executor": "Run",
|
||||
"CMake 应用程序.NOIP2005J_herbs_dp_backpack_MWASTE_BETTER.executor": "Run",
|
||||
"CMake 应用程序.NOIP2006S_jinming_budget_dp_knapsack.executor": "Run",
|
||||
"CMake 应用程序.SHOI2002_ski_dp.executor": "Run",
|
||||
"CMake 应用程序.exercises.executor": "Run",
|
||||
"CMake 应用程序.gdbh.executor": "Run",
|
||||
"CMake 应用程序.lc_135_candy.executor": "Run",
|
||||
"CMake 应用程序.luogu_P2196_miner_dp.executor": "Run",
|
||||
"CMake 应用程序.noip2003j_bigint.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_M02694_polish_notation_tree.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_M03441_sum_zero.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_M03532.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_M03704_brackets.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_T01011_sticks.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_T04117_split_int.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_T12559_biggest_smallest_combination.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_T27104_chicken_monitors.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_T27373_biggest_combination_t2.executor": "Run",
|
||||
"CMake 应用程序.test.executor": "Run",
|
||||
"CMake 调试.exercises.executor": "Debug",
|
||||
"CidrDebugProfileConversion": "true",
|
||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||
"Python.lc_127.executor": "Run",
|
||||
"Python.noi2001_food_chain_dsu.executor": "Run",
|
||||
"Python.pojcs101_M03247_palindromic_prime_init1.executor": "Debug",
|
||||
"RunOnceActivity.RadMigrateCodeStyle": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"RunOnceActivity.readMode.enableVisualFormatting": "true",
|
||||
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
||||
"RunOnceActivity.west.config.association.type.startup.service": "true",
|
||||
"cf.first.check.clang-format": "false",
|
||||
"cidr.known.project.marker": "true",
|
||||
"codeWithMe.voiceChat.enabledByDefault": "false",
|
||||
"deletionFromPopupRequiresConfirmation": "false",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "/Users/roger/coding/exercises/dp/backpack_dp",
|
||||
"node.js.detected.package.jshint": "true",
|
||||
"node.js.selected.package.jshint": "",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"org.rust.first.attach.projects": "true",
|
||||
"settings.editor.selected.configurable": "editor.preferences.completion.inline"
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"C/C++ 文件.D_pojcs101_M02692.cpp.executor": "Run",
|
||||
"C/C++ 文件.luogu_P3916_graph_iteration.cpp.executor": "Debug",
|
||||
"C/C++ 文件.luogu_UVA755.cpp.executor": "Run",
|
||||
"C/C++ 文件.luogu_ez_B3628.cpp.executor": "Run",
|
||||
"C/C++ 文件.luogu_model_dsu_P3367.cpp.executor": "Run",
|
||||
"C/C++ 文件.noip2003j_bigint.cpp.executor": "Run",
|
||||
"C/C++ 文件.ojcs101_E01003.cpp.executor": "Run",
|
||||
"C/C++ 文件.ojcs101_E01218.cpp.executor": "Run",
|
||||
"C/C++ 文件.ojcs101_E02883.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M01017_6_boxes.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M01088_ski.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M01321_chest_grid.cpp.executor": "Debug",
|
||||
"C/C++ 文件.pojcs101_M01328_radar_greedy.cpp.executor": "Debug",
|
||||
"C/C++ 文件.pojcs101_M01852_ants_falling.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M01922_ride_follower.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M02039_snakey_encryption.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M02431_cows_gas_leak.cpp.executor": "Debug",
|
||||
"C/C++ 文件.pojcs101_M02524_ubiquitous_religions_dsu.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M02692.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M02692_12_coins.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M02694_polish_notation_tree.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M03247_palindromic_prime.cpp.executor": "Run",
|
||||
"C/C++ 文件.pojcs101_M03441_sum_zero.cpp.executor": "Run",
|
||||
"CMake 应用程序.JLOI2009_binary_tree.executor": "Run",
|
||||
"CMake 应用程序.NOIP2005J_herbs_dp_backpack.executor": "Run",
|
||||
"CMake 应用程序.NOIP2005J_herbs_dp_backpack_MWASTE_BETTER.executor": "Run",
|
||||
"CMake 应用程序.NOIP2006S_jinming_budget_dp_knapsack.executor": "Run",
|
||||
"CMake 应用程序.NOIP2016J_bay.executor": "Run",
|
||||
"CMake 应用程序.SHOI2002_ski_dp.executor": "Run",
|
||||
"CMake 应用程序.dp__TJOI2007_walk_segments_dp.executor": "Run",
|
||||
"CMake 应用程序.dsa__linear_list__dsa_0201_dictionary.executor": "Run",
|
||||
"CMake 应用程序.exercises.executor": "Run",
|
||||
"CMake 应用程序.gdbh.executor": "Run",
|
||||
"CMake 应用程序.graph__luogu_P3916_graph_iteration.executor": "Run",
|
||||
"CMake 应用程序.lc_135_candy.executor": "Run",
|
||||
"CMake 应用程序.luogu_P1160_biodir_linked_list.executor": "Run",
|
||||
"CMake 应用程序.luogu_P2196_miner_dp.executor": "Run",
|
||||
"CMake 应用程序.noip2003j_bigint.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_M02694_polish_notation_tree.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_M03441_sum_zero.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_M03532.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_M03704_brackets.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_T01011_sticks.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_T04117_split_int.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_T12559_biggest_smallest_combination.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_T27104_chicken_monitors.executor": "Run",
|
||||
"CMake 应用程序.pojcs101_T27373_biggest_combination_t2.executor": "Run",
|
||||
"CMake 应用程序.test.executor": "Run",
|
||||
"CMake 调试.exercises.executor": "Debug",
|
||||
"CidrDebugProfileConversion": "true",
|
||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||
"Python.lc_127.executor": "Run",
|
||||
"Python.noi2001_food_chain_dsu.executor": "Run",
|
||||
"Python.pojcs101_M03247_palindromic_prime_init1.executor": "Debug",
|
||||
"RunOnceActivity.RadMigrateCodeStyle": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"RunOnceActivity.readMode.enableVisualFormatting": "true",
|
||||
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
||||
"RunOnceActivity.west.config.association.type.startup.service": "true",
|
||||
"cf.first.check.clang-format": "false",
|
||||
"cidr.known.project.marker": "true",
|
||||
"codeWithMe.voiceChat.enabledByDefault": "false",
|
||||
"deletionFromPopupRequiresConfirmation": "false",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "/Users/roger/coding/exercises/graph",
|
||||
"node.js.detected.package.jshint": "true",
|
||||
"node.js.selected.package.jshint": "",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"org.rust.first.attach.projects": "true",
|
||||
"settings.editor.selected.configurable": "preferences.sourceCode.C++"
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/dp/backpack_dp" />
|
||||
<recent name="$PROJECT_DIR$/graph" />
|
||||
<recent name="$PROJECT_DIR$" />
|
||||
<recent name="$PROJECT_DIR$/dp/backpack_dp" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/dsa/linear_list" />
|
||||
<recent name="$PROJECT_DIR$/dp/backpack_dp" />
|
||||
<recent name="$PROJECT_DIR$/_others" />
|
||||
<recent name="$PROJECT_DIR$/dp" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="CMake 应用程序.dp__TJOI2007_walk_segments_dp">
|
||||
<configuration default="true" type="CLionExternalRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true">
|
||||
<method v="2">
|
||||
<option name="CLION.EXTERNAL.BUILD" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<component name="RunManager" selected="CMake 应用程序.dsa__linear_list__dsa_0201_dictionary">
|
||||
<configuration default="true" type="CMakeBoostTestRunConfigurationType" factoryName="Boost Test" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" TEST_MODE="SUITE_TEST">
|
||||
<method v="2">
|
||||
<option name="BeforeTestRunTask" enabled="true" />
|
||||
@@ -261,11 +263,26 @@
|
||||
<option name="BeforeTestRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="JLOI2009_binary_tree" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="JLOI2009_binary_tree" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="JLOI2009_binary_tree">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="JLOI2009_binary_tree_GIVEUP" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="JLOI2009_binary_tree_GIVEUP" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="JLOI2009_binary_tree_GIVEUP">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="NOIP2003J_bigint" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="NOIP2003J_bigint" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="NOIP2003J_bigint">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="NOIP2016J_bay" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="NOIP2016J_bay" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="NOIP2016J_bay">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="SHOI2002_ski" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="SHOI2002_ski" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="SHOI2002_ski">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
@@ -336,11 +353,36 @@
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="dsa__linear_list__dsa_0201_dictionary" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="dsa__linear_list__dsa_0201_dictionary" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="dsa__linear_list__dsa_0201_dictionary">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="graph__ECNA2001_sort_letters" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="graph__ECNA2001_sort_letters" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="graph__ECNA2001_sort_letters">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="graph__luogu_P3916_graph_iteration" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="graph__luogu_P3916_graph_iteration" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="graph__luogu_P3916_graph_iteration">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="graph__luogu_P3916_graph_iteration_WRONG" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="graph__luogu_P3916_graph_iteration_WRONG" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="graph__luogu_P3916_graph_iteration_WRONG">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="lc_135_candy" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="lc_135_candy" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="lc_135_candy">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="luogu_P1160_biodir_linked_list" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="luogu_P1160_biodir_linked_list" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="luogu_P1160_biodir_linked_list">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="luogu_ez_B3628" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="luogu_ez_B3628" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="luogu_ez_B3628">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
@@ -351,11 +393,6 @@
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="noip2012s_kings_game" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="noip2012s_kings_game" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="noip2012s_kings_game">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="pojcs101_E01003" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="pojcs101_E01003" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="pojcs101_E01003">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
@@ -564,11 +601,18 @@
|
||||
<item itemvalue="CMake 应用程序.dp__NOIP1996S_miner_dp_MWASTE" />
|
||||
<item itemvalue="CMake 应用程序.dp__SHOI2002_ski_dp" />
|
||||
<item itemvalue="CMake 应用程序.dp__TJOI2007_walk_segments_dp" />
|
||||
<item itemvalue="CMake 应用程序.dsa__linear_list__dsa_0201_dictionary" />
|
||||
<item itemvalue="CMake 应用程序.graph__ECNA2001_sort_letters" />
|
||||
<item itemvalue="CMake 应用程序.graph__luogu_P3916_graph_iteration" />
|
||||
<item itemvalue="CMake 应用程序.graph__luogu_P3916_graph_iteration_WRONG" />
|
||||
<item itemvalue="CMake 应用程序.JLOI2009_binary_tree" />
|
||||
<item itemvalue="CMake 应用程序.JLOI2009_binary_tree_GIVEUP" />
|
||||
<item itemvalue="CMake 应用程序.lc_135_candy" />
|
||||
<item itemvalue="CMake 应用程序.luogu_ez_B3628" />
|
||||
<item itemvalue="CMake 应用程序.luogu_P1160_biodir_linked_list" />
|
||||
<item itemvalue="CMake 应用程序.luogu_template_dsu_P3367" />
|
||||
<item itemvalue="CMake 应用程序.NOIP2003J_bigint" />
|
||||
<item itemvalue="CMake 应用程序.noip2012s_kings_game" />
|
||||
<item itemvalue="CMake 应用程序.NOIP2016J_bay" />
|
||||
<item itemvalue="CMake 应用程序.pojcs101_E01003" />
|
||||
<item itemvalue="CMake 应用程序.pojcs101_E01218" />
|
||||
<item itemvalue="CMake 应用程序.pojcs101_E02883" />
|
||||
@@ -605,37 +649,79 @@
|
||||
</list>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Python.noi2001_food_chain_dsu" />
|
||||
<item itemvalue="Python.pojcs101_M03247_palindromic_prime_init1" />
|
||||
<item itemvalue="Python.noi2001_food_chain_dsu" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SelectedDebugProfileService"><![CDATA[{
|
||||
"profileIdByStamp": [
|
||||
<component name="SelectedDebugProfileService">{
|
||||
"profileIdByStamp": [
|
||||
{
|
||||
"first": {
|
||||
"##RUN_CONFIGURATION##": "CMake 应用程序._others__qyzgdbh",
|
||||
"cmake": "CMakeBuildProfile:Debug-GCC"
|
||||
"first": {
|
||||
"##RUN_CONFIGURATION##": "CMake 应用程序.JLOI2009_binary_tree",
|
||||
"cmake": "CMakeBuildProfile:Debug-GCC"
|
||||
},
|
||||
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
|
||||
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
|
||||
},
|
||||
{
|
||||
"first": {
|
||||
"##RUN_CONFIGURATION##": "CMake 应用程序.NOIP2003J_bigint",
|
||||
"cmake": "CMakeBuildProfile:Debug-GCC"
|
||||
"first": {
|
||||
"##RUN_CONFIGURATION##": "CMake 应用程序._others__qyz__gdbh",
|
||||
"cmake": "CMakeBuildProfile:Debug-GCC"
|
||||
},
|
||||
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
|
||||
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
|
||||
},
|
||||
{
|
||||
"first": {
|
||||
"##RUN_CONFIGURATION##": "CMake 应用程序.pojcs101_T27373_biggest_combination_t2",
|
||||
"cmake": "CMakeBuildProfile:Debug-GCC"
|
||||
"first": {
|
||||
"##RUN_CONFIGURATION##": "CMake 应用程序.dp__TJOI2007_walk_segments_dp",
|
||||
"cmake": "CMakeBuildProfile:Debug-GCC"
|
||||
},
|
||||
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
|
||||
"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",
|
||||
"cmake": "CMakeBuildProfile:Debug-GCC"
|
||||
},
|
||||
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
|
||||
},
|
||||
{
|
||||
"first": {
|
||||
"##RUN_CONFIGURATION##": "CMake 应用程序.graph__luogu_P3916_graph_iteration",
|
||||
"cmake": "CMakeBuildProfile:Debug-GCC"
|
||||
},
|
||||
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
|
||||
},
|
||||
{
|
||||
"first": {
|
||||
"##RUN_CONFIGURATION##": "CMake 应用程序.dsa__linear_list__dsa_0201_dictionary",
|
||||
"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 应用程序.pojcs101_T27373_biggest_combination_t2",
|
||||
"cmake": "CMakeBuildProfile:Debug-GCC"
|
||||
},
|
||||
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
|
||||
}
|
||||
],
|
||||
"modificationCount": 49
|
||||
}]]></component>
|
||||
"modificationCount": 69
|
||||
}</component>
|
||||
<component name="SharedIndexes">
|
||||
<attachedChunks>
|
||||
<set>
|
||||
@@ -670,7 +756,8 @@
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="CMakeLists.txt" />
|
||||
<MESSAGE value="1" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="1" />
|
||||
<MESSAGE value="Update CMakeLists.txt" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Update CMakeLists.txt" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
@@ -685,8 +772,28 @@
|
||||
<line>32</line>
|
||||
<option name="timeStamp" value="15" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||
<url>file://$PROJECT_DIR$/dp/TJOI2007_walk_segments_dp.cpp</url>
|
||||
<line>35</line>
|
||||
<option name="timeStamp" value="24" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||
<url>file://$PROJECT_DIR$/dp/TJOI2007_walk_segments_dp.cpp</url>
|
||||
<line>45</line>
|
||||
<option name="timeStamp" value="25" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||
<url>file://$PROJECT_DIR$/graph/luogu_P3916_graph_iteration.cpp</url>
|
||||
<line>66</line>
|
||||
<option name="timeStamp" value="36" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
<watches-manager>
|
||||
<configuration name="CMakeRunConfiguration">
|
||||
<watch expression="ans_cache" language="C++" />
|
||||
</configuration>
|
||||
</watches-manager>
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Graph {
|
||||
public:
|
||||
struct Node {
|
||||
vector<int> neighbors;
|
||||
int father = -1;
|
||||
int depth = -1;
|
||||
};
|
||||
|
||||
vector<Node> nodes;
|
||||
int depth = -1, breadth = -1;
|
||||
|
||||
void connect(int x, int y) {
|
||||
assert(x < nodes.size() && y < nodes.size());
|
||||
nodes[x].neighbors.push_back(y);
|
||||
nodes[y].neighbors.push_back(x);
|
||||
}
|
||||
|
||||
void init_tree() {
|
||||
vector<int> depths_map;
|
||||
init_tree(0, 0, depths_map);
|
||||
depth = depths_map.size();
|
||||
breadth = -1;
|
||||
for (const auto& d : depths_map) {
|
||||
breadth = max(breadth, d);
|
||||
}
|
||||
}
|
||||
|
||||
void init_tree(int node_idx, int current_depth, vector<int>& depths_map) {
|
||||
if (depths_map.size() <= current_depth) { depths_map.push_back(0); }
|
||||
depths_map[current_depth]++;
|
||||
for (const auto& neighbor : nodes[node_idx].neighbors) {
|
||||
if (neighbor == nodes[node_idx].father) { continue; }
|
||||
nodes[neighbor].father = node_idx;
|
||||
nodes[neighbor].depth = current_depth + 1;
|
||||
init_tree(neighbor, current_depth + 1, depths_map);
|
||||
}
|
||||
}
|
||||
|
||||
int get_cost(int start, int end) {
|
||||
int cost = 0;
|
||||
while (nodes[start].depth > nodes[end].depth) {
|
||||
cost += 2;
|
||||
start = nodes[start].father;
|
||||
}
|
||||
while (nodes[start].depth < nodes[end].depth) {
|
||||
cost += 1;
|
||||
end = nodes[end].father;
|
||||
}
|
||||
while (start != end) {
|
||||
cost += 3;
|
||||
start = nodes[start].father;
|
||||
end = nodes[end].father;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Graph tree;
|
||||
int n;
|
||||
|
||||
int main() {
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int x, y;
|
||||
|
||||
cin >> n;
|
||||
tree.nodes.resize(n);
|
||||
for (int _ = 1; _ < n; _++) {
|
||||
cin >> x >> y;
|
||||
tree.connect(x - 1, y - 1);
|
||||
}
|
||||
tree.init_tree();
|
||||
cout << tree.depth << endl << tree.breadth << endl;
|
||||
|
||||
cin >> x >> y;
|
||||
cout << tree.get_cost(x - 1, y - 1) << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class BinaryTree {
|
||||
public:
|
||||
struct Node {
|
||||
int left = -1, right = -1, father = -1;
|
||||
};
|
||||
|
||||
vector<Node> nodes;
|
||||
|
||||
int depth = -1, breadth = -1;
|
||||
|
||||
void connect(int father, int son) {
|
||||
assert(father < nodes.size() && son < nodes.size());
|
||||
if (nodes[son].father != -1 && nodes[father].father == -1) { swap(father, son); }
|
||||
nodes[son].father = father;
|
||||
if (nodes[father].left == -1) {
|
||||
nodes[father].left = son;
|
||||
} else {
|
||||
nodes[father].right = son;
|
||||
}
|
||||
}
|
||||
|
||||
void dfs() {
|
||||
depth = -1, breadth = -1;
|
||||
vector<int> depths_map;
|
||||
dfs(0, 0, depths_map);
|
||||
for (const int d : depths_map) {
|
||||
breadth = max(breadth, d);
|
||||
}
|
||||
}
|
||||
|
||||
void dfs(int node_idx, int _depth, vector<int>& depths_map) {
|
||||
depth = max(depth, _depth);
|
||||
if (_depth >= depths_map.size()) {
|
||||
depths_map.push_back(0);
|
||||
}
|
||||
depths_map[_depth]++;
|
||||
if (nodes[node_idx].left != -1) {
|
||||
dfs(nodes[node_idx].left, _depth + 1, depths_map);
|
||||
}
|
||||
if (nodes[node_idx].right != -1) {
|
||||
dfs(nodes[node_idx].right, _depth + 1, depths_map);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
BinaryTree tree;
|
||||
int n;
|
||||
|
||||
int main() {
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n;
|
||||
tree.nodes.resize(n);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 在线处理?
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
using Boat = pair<int, vector<int>>;
|
||||
|
||||
constexpr int MAX_N = 1e5 + 5, DAY_TIME = 86400;
|
||||
|
||||
vector<Boat> boats;
|
||||
unordered_map<int, int> nations_statistics;
|
||||
int start_time = -DAY_TIME, current_time = 0, pointer = 0, nations_count;
|
||||
|
||||
void modify_nations_statistics(vector<int> people, int multiplier = 1) {
|
||||
for (int nation : people) {
|
||||
if (nations_statistics[nation] == 0) { nations_count++; }
|
||||
nations_statistics[nation] += multiplier;
|
||||
if (nations_statistics[nation] == 0) { nations_count--; }
|
||||
}
|
||||
}
|
||||
|
||||
int count_nations() {
|
||||
// int ans = 0;
|
||||
// for (auto& [nation, count] : nations_statistics) {
|
||||
// if (count > 0) { ans++; }
|
||||
// }
|
||||
// return ans;
|
||||
return nations_count;
|
||||
}
|
||||
|
||||
int main() {
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int n;
|
||||
cin >> n;
|
||||
for (int i = 0; i < n; i++) {
|
||||
int arrival_time, people_amount;
|
||||
cin >> arrival_time >> people_amount;
|
||||
boats.emplace_back(arrival_time, vector<int>(people_amount));
|
||||
for (int j = 0; j < people_amount; j++) {
|
||||
cin >> boats.back().second[j];
|
||||
}
|
||||
// ONLINE
|
||||
modify_nations_statistics(boats.back().second);
|
||||
start_time = arrival_time - DAY_TIME;
|
||||
while (pointer < boats.size() && boats[pointer].first <= start_time) {
|
||||
modify_nations_statistics(boats[pointer].second, -1);
|
||||
pointer++;
|
||||
}
|
||||
cout << count_nations() << endl;
|
||||
}
|
||||
|
||||
// for (int i = 0, j = 0; i < boats.size(); i++) {
|
||||
// current_time = boats[i].first + DAY_TIME;
|
||||
// // modify_nations_statistics(boats[i].second);
|
||||
// while (j < boats.size() && boats[j].first <= current_time) {
|
||||
// modify_nations_statistics(boats[j].second);
|
||||
// j++;
|
||||
// }
|
||||
// cout << count_nations() << endl;
|
||||
// modify_nations_statistics(boats[i].second, -1);
|
||||
// }
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
using Segment = pair<int, int>;
|
||||
|
||||
constexpr int MAX_N = 20005;
|
||||
int n;
|
||||
Segment segments[MAX_N];
|
||||
|
||||
pair<int, int> dp[MAX_N]; // 从这一层的线段左/右边出去
|
||||
|
||||
void log_dp() {
|
||||
for (int i = 0; i < n; i++) {
|
||||
clog << dp[i].first << "\t" << dp[i].second << endl;
|
||||
}
|
||||
}
|
||||
|
||||
pair<int, int> get_min_steps(const Segment& segment, const int start_pos) {
|
||||
const int len = segment.second - segment.first;
|
||||
if (start_pos <= segment.first) {
|
||||
return {segment.second - start_pos + len, segment.second - start_pos};
|
||||
}
|
||||
if (start_pos >= segment.second) {
|
||||
return {start_pos - segment.first, start_pos - segment.first + len};
|
||||
}
|
||||
return {
|
||||
len + (segment.second - start_pos),
|
||||
len + (start_pos - segment.first)
|
||||
};
|
||||
}
|
||||
|
||||
// pair<int, int> get_min_steps(const Segment& segment, const Segment& previous_segment) {
|
||||
// auto [first1, second1] = get_min_steps(segment, previous_segment.second);
|
||||
// auto [first2, second2] = get_min_steps(segment, previous_segment.first);
|
||||
// return {min(first1, first2), min(second1, second2)};
|
||||
// }
|
||||
|
||||
int solve_dp() {
|
||||
dp[0] = get_min_steps(segments[0], 1);
|
||||
for (int i = 1; i < n; i++) {
|
||||
auto [first1, second1] = get_min_steps(segments[i], segments[i - 1].first);
|
||||
auto [first2, second2] = get_min_steps(segments[i], segments[i - 1].second);
|
||||
first1 += dp[i - 1].first, second1 += dp[i - 1].first;
|
||||
first2 += dp[i - 1].second, second2 += dp[i - 1].second;
|
||||
dp[i] = {min(first1, first2), min(second1, second2)};
|
||||
}
|
||||
return min(dp[n - 1].first, dp[n - 1].second);
|
||||
}
|
||||
|
||||
int main() {
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n;
|
||||
for (int i = 0; i < n; i++) {
|
||||
cin >> segments[i].first >> segments[i].second;
|
||||
}
|
||||
segments[n] = {n, n}, n++;
|
||||
cout << solve_dp() + n - 2 << endl;
|
||||
log_dp();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ vector<FlatItem> generate_flat_items(OriginalItem item) {
|
||||
void solve_dp() {
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (items[i].item.value == -1) { continue; }
|
||||
for (int w=capacity; w>=1; w--) {
|
||||
for (int w = capacity; w >= 1; w--) {
|
||||
// dp[w] = dp[w] // 不买
|
||||
for (const auto& [weight, value] : generate_flat_items(items[i])) {
|
||||
if (w >= weight) {
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
vector<string> words;
|
||||
|
||||
string deleted_char(const string& word, const int idx) {
|
||||
assert(0 <= idx && idx < word.size());
|
||||
return word.substr(0, idx) + word.substr(idx + 1);
|
||||
}
|
||||
|
||||
vector<string> query(const string& s) {
|
||||
vector<string> results;
|
||||
for (string word : words) {
|
||||
switch (static_cast<int>(word.size()) - static_cast<int>(s.size())) {
|
||||
case 1: { // 需要删
|
||||
for (int i = 0; i < word.size(); i++) {
|
||||
if (word[i] != s[i]) {
|
||||
if (deleted_char(word, i) == s) {
|
||||
results.push_back(word);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case -1: {
|
||||
for (int i = 0; i < s.size(); i++) {
|
||||
if (word[i] != s[i]) {
|
||||
if (deleted_char(s, i) == word) {
|
||||
results.push_back(word);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
if (word == s) { return vector{word}; }
|
||||
int diff_count = 0;
|
||||
for (int i = 0; i < s.size(); i++) {
|
||||
if (word[i] != s[i]) {
|
||||
diff_count++;
|
||||
}
|
||||
if (diff_count > 1) { break; }
|
||||
}
|
||||
if (diff_count == 1) {
|
||||
results.push_back(word);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
int main() {
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
string s;
|
||||
while (cin >> s && s[0] != '#') {
|
||||
words.push_back(s);
|
||||
}
|
||||
while (cin >> s && s[0] != '#') {
|
||||
vector<string> results = query(s);
|
||||
if (!results.empty() && results[0] == s) {
|
||||
cout << s << " is correct" << endl;
|
||||
continue;
|
||||
}
|
||||
cout << s << ": ";
|
||||
for (const string& result : results) {
|
||||
cout << result << " ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Graph {
|
||||
public:
|
||||
using VertexId = int;
|
||||
using EdgeId = int;
|
||||
|
||||
struct Edge {
|
||||
VertexId target_vertex = -1;
|
||||
EdgeId next_edge = -1;
|
||||
};
|
||||
|
||||
vector<Edge> edges;
|
||||
vector<EdgeId> first_edges;
|
||||
|
||||
explicit Graph(int vertices_amount, int edges_amount = 0) : first_edges(vertices_amount, -1) {
|
||||
edges.reserve(edges_amount);
|
||||
}
|
||||
|
||||
void add_edge(VertexId source_vertex, VertexId target_vertex) {
|
||||
const EdgeId edge_id = edges.size();
|
||||
edges.push_back({.target_vertex = target_vertex, .next_edge = first_edges[source_vertex]}); // 所以遍历顺序相反!
|
||||
first_edges[source_vertex] = edge_id;
|
||||
}
|
||||
};
|
||||
|
||||
constexpr int MAX_V = 1e5 + 5;
|
||||
|
||||
int v, e;
|
||||
int ans_cache[MAX_V];
|
||||
|
||||
int dfs(const Graph& graph, int vertex, int start_vertex) {
|
||||
if (ans_cache[vertex] != -1) { return ans_cache[vertex]; }
|
||||
ans_cache[vertex] = start_vertex;
|
||||
for (int edge_id = graph.first_edges[vertex]; edge_id != -1; edge_id = graph.edges[edge_id].next_edge) {
|
||||
dfs(graph, graph.edges[edge_id].target_vertex, start_vertex);
|
||||
}
|
||||
return ans_cache[vertex];
|
||||
}
|
||||
|
||||
int dfs(const Graph& graph, int vertex) {
|
||||
// 反向建图,从大到小 dfs
|
||||
return dfs(graph, vertex, vertex);
|
||||
}
|
||||
|
||||
int main() {
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> v >> e;
|
||||
|
||||
Graph graph(v, e);
|
||||
|
||||
for (int _ = 0; _ < e; _++) {
|
||||
int x, y;
|
||||
cin >> x >> y;
|
||||
graph.add_edge(y - 1, x - 1); // Reversed graph
|
||||
}
|
||||
|
||||
memset(ans_cache, -1, sizeof(ans_cache));
|
||||
|
||||
for (int vertex = v - 1; vertex >= 0; vertex--) {
|
||||
dfs(graph, vertex);
|
||||
}
|
||||
for (int vertex = 0; vertex < v; vertex++) {
|
||||
cout << ans_cache[vertex] + 1 << " ";
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Graph {
|
||||
public:
|
||||
using VertexId = int;
|
||||
using EdgeId = int;
|
||||
|
||||
struct Edge {
|
||||
VertexId target_vertex = -1;
|
||||
EdgeId next_edge = -1;
|
||||
};
|
||||
|
||||
vector<Edge> edges;
|
||||
vector<EdgeId> first_edges;
|
||||
|
||||
explicit Graph(int vertices_amount, int edges_amount = 0) : first_edges(vertices_amount, -1) {
|
||||
edges.reserve(edges_amount);
|
||||
}
|
||||
|
||||
void add_edge(VertexId source_vertex, VertexId target_vertex) {
|
||||
const EdgeId edge_id = edges.size();
|
||||
edges.push_back({.target_vertex = target_vertex, .next_edge = first_edges[source_vertex]}); // 所以遍历顺序相反!
|
||||
first_edges[source_vertex] = edge_id;
|
||||
}
|
||||
};
|
||||
|
||||
constexpr int MAX_V = 1e5 + 5;
|
||||
|
||||
int v, e;
|
||||
int ans_cache[MAX_V];
|
||||
|
||||
int dfs(const Graph& graph, int vertex) {
|
||||
// 如果从小到大 dfs,是不需要在此处取 max 的
|
||||
if (ans_cache[vertex] != -1) { return ans_cache[vertex]; }
|
||||
ans_cache[vertex] = vertex;
|
||||
if (graph.first_edges[vertex] == -1) { return ans_cache[vertex]; }
|
||||
for (int edge_id = graph.first_edges[vertex]; edge_id != -1; edge_id = graph.edges[edge_id].next_edge) {
|
||||
ans_cache[vertex] = max(ans_cache[vertex], dfs(graph, graph.edges[edge_id].target_vertex));
|
||||
}
|
||||
return ans_cache[vertex];
|
||||
}
|
||||
|
||||
int main() {
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> v >> e;
|
||||
|
||||
Graph graph(v, e);
|
||||
|
||||
for (int _ = 0; _ < e; _++) {
|
||||
int x, y;
|
||||
cin >> x >> y;
|
||||
graph.add_edge(x - 1, y - 1);
|
||||
}
|
||||
|
||||
memset(ans_cache, -1, sizeof(ans_cache));
|
||||
|
||||
for (int vertex = 0; vertex < v; vertex++) {
|
||||
cout << dfs(graph, vertex) + 1 << " ";
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class LinkedList {
|
||||
public:
|
||||
struct Node {
|
||||
int previous = -1, next = -1;
|
||||
};
|
||||
|
||||
vector<Node> nodes;
|
||||
|
||||
int get_adjacent(int idx, bool next) const {
|
||||
if (next) { return nodes[idx].next; }
|
||||
return nodes[idx].previous;
|
||||
}
|
||||
|
||||
void add(int l, int r) {
|
||||
if (l > -1) { nodes[l].next = nodes.size(); }
|
||||
if (r > -1) { nodes[r].previous = nodes.size(); }
|
||||
nodes.push_back({.previous = l, .next = r});
|
||||
}
|
||||
|
||||
void remove(int idx) {
|
||||
if (nodes[idx].previous > -1) {
|
||||
nodes[nodes[idx].previous].next = nodes[idx].next;
|
||||
}
|
||||
if (nodes[idx].next > -1) {
|
||||
nodes[nodes[idx].next].previous = nodes[idx].previous;
|
||||
}
|
||||
nodes[idx] = {-2, -2};
|
||||
}
|
||||
|
||||
void print() {
|
||||
int start_idx = -1;
|
||||
for (int i = 0; i < nodes.size(); i++) {
|
||||
if (nodes[i].previous == -1) {
|
||||
start_idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = start_idx; i != -1; i = nodes[i].next) {
|
||||
cout << i + 1 << " ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
};
|
||||
|
||||
LinkedList l;
|
||||
|
||||
int main() {
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
|
||||
int n;
|
||||
int to_be_operated;
|
||||
bool is_next;
|
||||
|
||||
cin >> n;
|
||||
|
||||
l.add(-1, -1);
|
||||
|
||||
for (int _ = 0; _ < n - 1; _++) {
|
||||
cin >> to_be_operated >> is_next;
|
||||
to_be_operated--;
|
||||
int adj = l.get_adjacent(to_be_operated, is_next);
|
||||
if (is_next) {
|
||||
l.add(to_be_operated, adj);
|
||||
} else {
|
||||
l.add(adj, to_be_operated);
|
||||
}
|
||||
}
|
||||
cin >> n;
|
||||
for (int _ = 0; _ < n; _++) {
|
||||
cin >> to_be_operated;
|
||||
l.remove(to_be_operated - 1);
|
||||
}
|
||||
|
||||
l.print();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user