This commit is contained in:
2026-08-06 23:20:25 +08:00
parent f87523a003
commit 94bdf44889
11 changed files with 426 additions and 50 deletions
+2 -2
View File
@@ -206,7 +206,7 @@
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexedValue" value="SUGGESTION" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexedValue" value="WARNING" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexedValue" value="WARNING" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexedValue" value="WARNING" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexedValue" value="WARNING" type="string" />
@@ -230,7 +230,7 @@
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexedValue" value="SUGGESTION" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexedValue" value="SUGGESTION" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseInternalLinkage/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseInternalLinkage/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexedValue" value="SUGGESTION" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexedValue" value="HINT" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexedValue" value="HINT" type="string" />
+9 -1
View File
@@ -1,2 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module classpath="CIDR" type="CPP_MODULE" version="4" /> <module external.system.id="pyproject.toml" type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="~/coding/exercises/.venv" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+1
View File
@@ -3,6 +3,7 @@
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/exercises.iml" filepath="$PROJECT_DIR$/.idea/exercises.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/exercises.iml" filepath="$PROJECT_DIR$/.idea/exercises.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/exercises2.iml" filepath="$PROJECT_DIR$/.idea/exercises2.iml" />
</modules> </modules>
</component> </component>
</project> </project>
+99 -26
View File
@@ -21,9 +21,11 @@
<component name="CMakeRunConfigurationManager"> <component name="CMakeRunConfigurationManager">
<generated> <generated>
<config projectName="exercises" targetName="pojcs101_M02692_12_coins" /> <config projectName="exercises" targetName="pojcs101_M02692_12_coins" />
<config projectName="exercises" targetName="pojcs101_M03532" />
<config projectName="exercises" targetName="pojcs101_M01321_chest_grid" /> <config projectName="exercises" targetName="pojcs101_M01321_chest_grid" />
<config projectName="exercises" targetName="pojcs101_E02883" /> <config projectName="exercises" targetName="pojcs101_E02883" />
<config projectName="exercises" targetName="pojcs101_M02694_polish_notation_tree" /> <config projectName="exercises" targetName="pojcs101_M02694_polish_notation_tree" />
<config projectName="exercises" targetName="noip2012s_kings_game" />
<config projectName="exercises" targetName="CMakeCXXCompilerId" /> <config projectName="exercises" targetName="CMakeCXXCompilerId" />
<config projectName="exercises" targetName="pojcs101_M01017_6_boxes" /> <config projectName="exercises" targetName="pojcs101_M01017_6_boxes" />
<config projectName="exercises" targetName="pojcs101_M01002_memorable_number" /> <config projectName="exercises" targetName="pojcs101_M01002_memorable_number" />
@@ -31,13 +33,17 @@
<config projectName="exercises" targetName="pojcs101_M03247_palindromic_prime" /> <config projectName="exercises" targetName="pojcs101_M03247_palindromic_prime" />
<config projectName="exercises" targetName="pojcs101_E01218" /> <config projectName="exercises" targetName="pojcs101_E01218" />
<config projectName="exercises" targetName="exercises" /> <config projectName="exercises" targetName="exercises" />
<config projectName="exercises" targetName="pojcs101_M03704_brackets" />
<config projectName="exercises" targetName="luogu_ez_B3628" /> <config projectName="exercises" targetName="luogu_ez_B3628" />
<config projectName="exercises" targetName="pojcs101_M03441_sum_zero" />
<config projectName="exercises" targetName="pojcs101_T01011_sticks_WRONG" />
<config projectName="exercises" targetName="pojcs101_M01328_radar_greedy" /> <config projectName="exercises" targetName="pojcs101_M01328_radar_greedy" />
<config projectName="exercises" targetName="pojcs101_M01852_ants_falling" /> <config projectName="exercises" targetName="pojcs101_M01852_ants_falling" />
<config projectName="exercises" targetName="pojcs101_M02692_12_coins_WRONG" /> <config projectName="exercises" targetName="pojcs101_M02692_12_coins_WRONG" />
<config projectName="exercises" targetName="pojcs101_M02746_josephus_problem_simulation" /> <config projectName="exercises" targetName="pojcs101_M02746_josephus_problem_simulation" />
<config projectName="exercises" targetName="pojcs101_M02039_snakey_encryption" /> <config projectName="exercises" targetName="pojcs101_M02039_snakey_encryption" />
<config projectName="exercises" targetName="pojcs101_M01088_ski_WRONG" /> <config projectName="exercises" targetName="pojcs101_M01088_ski_WRONG" />
<config projectName="exercises" targetName="lc_135_candy" />
<config projectName="exercises" targetName="pojcs101_T01011_sticks" /> <config projectName="exercises" targetName="pojcs101_T01011_sticks" />
<config projectName="exercises" targetName="pojcs101_M02431_cows_gas_leak_WRONG" /> <config projectName="exercises" targetName="pojcs101_M02431_cows_gas_leak_WRONG" />
<config projectName="exercises" targetName="pojcs101_M01922_ride_follower" /> <config projectName="exercises" targetName="pojcs101_M01922_ride_follower" />
@@ -48,20 +54,21 @@
</generated> </generated>
</component> </component>
<component name="CMakeSettings" AUTO_RELOAD="true"> <component name="CMakeSettings" AUTO_RELOAD="true">
<configurations> <configurations />
<configuration PROFILE_NAME="Debug-GCC" ENABLED="true" CONFIG_NAME="Debug" TOOLCHAIN_NAME="GCC" />
</configurations>
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="4491295e-723c-4e0b-b7b4-9be1cbde5db8" name="更改" comment="CMakeLists.txt"> <list default="true" id="4491295e-723c-4e0b-b7b4-9be1cbde5db8" name="更改" comment="CMakeLists.txt">
<change afterPath="$PROJECT_DIR$/pojcs101_M02746_josephus_problem_simulation.cpp" afterDir="false" /> <change afterPath="$PROJECT_DIR$/lc_135_candy.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pojcs101_M03247_palindromic_prime.cpp" afterDir="false" /> <change afterPath="$PROJECT_DIR$/noi2001_food_chain_dsu.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pojcs101_M03247_palindromic_prime_init1.py" afterDir="false" /> <change afterPath="$PROJECT_DIR$/noip2012s_kings_game.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pojcs101_T01011_sticks.cpp" afterDir="false" /> <change afterPath="$PROJECT_DIR$/pojcs101_M03441_sum_zero.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pojcs101_T01011_sticks_WRONG.cpp" afterDir="false" /> <change afterPath="$PROJECT_DIR$/pojcs101_M03532.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" /> <change afterPath="$PROJECT_DIR$/pojcs101_M03704_brackets.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/exercises.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/exercises.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.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_T01011_sticks.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/pojcs101_T01011_sticks.cpp" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -137,14 +144,20 @@
"C/C++ 文件.pojcs101_M02692_12_coins.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_M02694_polish_notation_tree.cpp.executor": "Run",
"C/C++ 文件.pojcs101_M03247_palindromic_prime.cpp.executor": "Run", "C/C++ 文件.pojcs101_M03247_palindromic_prime.cpp.executor": "Run",
"C/C++ 文件.pojcs101_M03441_sum_zero.cpp.executor": "Run",
"CMake 应用程序.exercises.executor": "Run", "CMake 应用程序.exercises.executor": "Run",
"CMake 应用程序.lc_135_candy.executor": "Run",
"CMake 应用程序.pojcs101_M02694_polish_notation_tree.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_T01011_sticks.executor": "Run",
"CMake 调试.exercises.executor": "Debug", "CMake 调试.exercises.executor": "Debug",
"CidrDebugProfileConversion": "true", "CidrDebugProfileConversion": "true",
"ModuleVcsDetector.initialDetectionPerformed": "true", "ModuleVcsDetector.initialDetectionPerformed": "true",
"Python.lc_127.executor": "Run", "Python.lc_127.executor": "Run",
"Python.pojcs101_M03247_palindromic_prime_init1.executor": "Run", "Python.noi2001_food_chain_dsu.executor": "Run",
"Python.pojcs101_M03247_palindromic_prime_init1.executor": "Debug",
"RunOnceActivity.RadMigrateCodeStyle": "true", "RunOnceActivity.RadMigrateCodeStyle": "true",
"RunOnceActivity.ShowReadmeOnStart": "true", "RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.cidr.known.project.marker": "true", "RunOnceActivity.cidr.known.project.marker": "true",
@@ -170,7 +183,12 @@
<recent name="$PROJECT_DIR$" /> <recent name="$PROJECT_DIR$" />
</key> </key>
</component> </component>
<component name="RunManager" selected="CMake 应用程序.pojcs101_T01011_sticks"> <component name="RunManager" selected="CMake 应用程序.lc_135_candy">
<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>
<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"> <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"> <method v="2">
<option name="BeforeTestRunTask" enabled="true" /> <option name="BeforeTestRunTask" enabled="true" />
@@ -196,7 +214,7 @@
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" /> <option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true"> <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"> <method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" /> <option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method> </method>
@@ -211,6 +229,11 @@
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" /> <option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method> </method>
</configuration> </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"> <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"> <method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" /> <option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
@@ -311,17 +334,56 @@
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" /> <option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration name="pojcs101_M03441_sum_zero" 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_M03441_sum_zero" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="pojcs101_M03441_sum_zero">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="pojcs101_M03532" 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_M03532" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="pojcs101_M03532">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="pojcs101_M03704_brackets" 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_M03704_brackets" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="pojcs101_M03704_brackets">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="pojcs101_T01011_sticks" 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_T01011_sticks" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="pojcs101_T01011_sticks"> <configuration name="pojcs101_T01011_sticks" 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_T01011_sticks" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="pojcs101_T01011_sticks">
<method v="2"> <method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" /> <option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration name="pojcs101_M03247_palindromic_prime.cpp" type="CppFileRunConfiguration" factoryName="CppFileRunConfiguration" temporary="true" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="pojcs101_M03247_palindromic_prime.cpp" CONFIG_NAME="pojcs101_M03247_palindromic_prime.cpp"> <configuration name="pojcs101_T01011_sticks_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="pojcs101_T01011_sticks_WRONG" CONFIG_NAME="Debug-GCC" RUN_TARGET_PROJECT_NAME="exercises" RUN_TARGET_NAME="pojcs101_T01011_sticks_WRONG">
<option name="sourceFile" value="pojcs101_M03247_palindromic_prime.cpp" />
<method v="2"> <method v="2">
<option name="com.jetbrains.cidr.cpp.runfile.CppFileBuildBeforeRunTaskProvider$BasicBuildBeforeRunTask" enabled="true" /> <option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration name="noi2001_food_chain_dsu" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="exercises" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="DEBUG_JUST_MY_CODE" value="false" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="RUN_TOOL" value="" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/noi2001_food_chain_dsu.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="pojcs101_M03247_palindromic_prime_init1" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <configuration name="pojcs101_M03247_palindromic_prime_init1" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="exercises" /> <module name="exercises" />
<option name="ENV_FILES" value="" /> <option name="ENV_FILES" value="" />
@@ -348,11 +410,11 @@
<method v="2" /> <method v="2" />
</configuration> </configuration>
<list> <list>
<item itemvalue="C/C++ 文件.pojcs101_M03247_palindromic_prime.cpp" />
<item itemvalue="CMake 应用程序.pojcs101_M02746_josephus_problem" />
<item itemvalue="CMake 应用程序.CMakeCXXCompilerId" /> <item itemvalue="CMake 应用程序.CMakeCXXCompilerId" />
<item itemvalue="CMake 应用程序.lc_135_candy" />
<item itemvalue="CMake 应用程序.luogu_ez_B3628" /> <item itemvalue="CMake 应用程序.luogu_ez_B3628" />
<item itemvalue="CMake 应用程序.luogu_template_dsu_P3367" /> <item itemvalue="CMake 应用程序.luogu_template_dsu_P3367" />
<item itemvalue="CMake 应用程序.noip2012s_kings_game" />
<item itemvalue="CMake 应用程序.pojcs101_E01003" /> <item itemvalue="CMake 应用程序.pojcs101_E01003" />
<item itemvalue="CMake 应用程序.pojcs101_E01218" /> <item itemvalue="CMake 应用程序.pojcs101_E01218" />
<item itemvalue="CMake 应用程序.pojcs101_E02883" /> <item itemvalue="CMake 应用程序.pojcs101_E02883" />
@@ -371,13 +433,19 @@
<item itemvalue="CMake 应用程序.pojcs101_M02692_12_coins" /> <item itemvalue="CMake 应用程序.pojcs101_M02692_12_coins" />
<item itemvalue="CMake 应用程序.pojcs101_M02692_12_coins_WRONG" /> <item itemvalue="CMake 应用程序.pojcs101_M02692_12_coins_WRONG" />
<item itemvalue="CMake 应用程序.pojcs101_M02694_polish_notation_tree" /> <item itemvalue="CMake 应用程序.pojcs101_M02694_polish_notation_tree" />
<item itemvalue="CMake 应用程序.pojcs101_M02746_josephus_problem" />
<item itemvalue="CMake 应用程序.pojcs101_M03247_palindromic_prime" /> <item itemvalue="CMake 应用程序.pojcs101_M03247_palindromic_prime" />
<item itemvalue="CMake 应用程序.pojcs101_M03441_sum_zero" />
<item itemvalue="CMake 应用程序.pojcs101_M03532" />
<item itemvalue="CMake 应用程序.pojcs101_M03704_brackets" />
<item itemvalue="CMake 应用程序.pojcs101_T01011_sticks" /> <item itemvalue="CMake 应用程序.pojcs101_T01011_sticks" />
<item itemvalue="CMake 应用程序.pojcs101_T01011_sticks_WRONG" />
<item itemvalue="Python.noi2001_food_chain_dsu" />
<item itemvalue="Python.pojcs101_M03247_palindromic_prime_init1" /> <item itemvalue="Python.pojcs101_M03247_palindromic_prime_init1" />
</list> </list>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="C/C++ 文件.pojcs101_M03247_palindromic_prime.cpp" /> <item itemvalue="Python.noi2001_food_chain_dsu" />
<item itemvalue="Python.pojcs101_M03247_palindromic_prime_init1" /> <item itemvalue="Python.pojcs101_M03247_palindromic_prime_init1" />
</list> </list>
</recent_temporary> </recent_temporary>
@@ -399,6 +467,8 @@
<updated>1784800801763</updated> <updated>1784800801763</updated>
<workItem from="1784856532675" duration="4766000" /> <workItem from="1784856532675" duration="4766000" />
<workItem from="1785509013065" duration="2577000" /> <workItem from="1785509013065" duration="2577000" />
<workItem from="1785852394849" duration="8298000" />
<workItem from="1785935635180" duration="9461000" />
</task> </task>
<servers /> <servers />
</component> </component>
@@ -419,15 +489,17 @@
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
<breakpoints> <breakpoints>
<line-breakpoint enabled="true" type="CMakeLineBreakpoint"> <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/CMakeLists.txt</url> <url>file://$PROJECT_DIR$/noi2001_food_chain_dsu.py</url>
<line>12</line> <line>75</line>
<option name="timeStamp" value="7" /> <option name="timeStamp" value="6" />
</line-breakpoint>
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
<url>file://$PROJECT_DIR$/pojcs101_M03441_sum_zero.cpp</url>
<line>32</line>
<option name="timeStamp" value="15" />
</line-breakpoint> </line-breakpoint>
</breakpoints> </breakpoints>
<default-breakpoints>
<breakpoint type="CMakeExceptionBreakpoint" />
</default-breakpoints>
</breakpoint-manager> </breakpoint-manager>
</component> </component>
<component name="XSLT-Support.FileAssociations.UIState"> <component name="XSLT-Support.FileAssociations.UIState">
@@ -435,6 +507,7 @@
<select /> <select />
</component> </component>
<component name="com.intellij.coverage.CoverageDataManagerImpl"> <component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/exercises$noi2001_food_chain_dsu.coverage" NAME="noi2001_food_chain_dsu 覆盖结果" MODIFIED="1785943248536" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/exercises$lc_127.coverage" NAME="lc_127 覆盖结果" MODIFIED="1784859593317" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" /> <SUITE FILE_PATH="coverage/exercises$lc_127.coverage" NAME="lc_127 覆盖结果" MODIFIED="1784859593317" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/exercises$pojcs101_M03247_palindromic_prime_init1.coverage" NAME="pojcs101_M03247_palindromic_prime_init1 覆盖结果" MODIFIED="1785513899078" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" /> <SUITE FILE_PATH="coverage/exercises$pojcs101_M03247_palindromic_prime_init1.coverage" NAME="pojcs101_M03247_palindromic_prime_init1 覆盖结果" MODIFIED="1785513899078" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component> </component>
+53
View File
@@ -0,0 +1,53 @@
#include <iostream>
#include <vector>
using namespace std;
class Solution {
static vector<int> get_upstairs_lengths(vector<int>& ratings) {
vector<int> upstairs(ratings.size(), 1);
for (int i = 1; i < ratings.size(); i++) {
if (ratings[i] > ratings[i - 1]) {
upstairs[i] = upstairs[i - 1] + 1;
}
}
return upstairs;
}
static vector<int> get_downstairs_lengths(vector<int>& ratings) {
vector<int> downstairs(ratings.size(), 1);
for (int i = ratings.size() - 2; i >= 0; i--) {
if (ratings[i] > ratings[i + 1]) {
downstairs[i] = downstairs[i + 1] + 1;
}
}
return downstairs;
}
public:
int candy(vector<int>& ratings) {
vector<int> upstairs = get_upstairs_lengths(ratings);
vector<int> downstairs = get_downstairs_lengths(ratings);
int ans = 0;
for (int i = 0; i < ratings.size(); i++) {
ans += max(upstairs[i], downstairs[i]);
}
return ans;
}
};
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
size_t ratings_amount;
cin >> ratings_amount;
vector<int> ratings(ratings_amount);
for (int i = 0; i < ratings_amount; i++) {
cin >> ratings[i];
}
Solution solution;
cout << solution.candy(ratings) << endl;
return 0;
}
+77
View File
@@ -0,0 +1,77 @@
import dataclasses
import sys
class Dsu:
@dataclasses.dataclass
class Node:
parent: int
tree_size: int = 1
weight: int = 0
def __init__(self, n: int):
self.nodes: list["Dsu.Node"] = [self.Node(i) for i in range(n)]
def find(self, x: int) -> int:
if self.nodes[x].parent == x:
return x
parent = self.find(self.nodes[x].parent)
self.nodes[x].weight \
= (self.nodes[self.nodes[x].parent].weight + self.nodes[x].weight + 12) % 3
self.nodes[x].parent = parent
return parent
def union(self, x: int, y: int, weight_offset: int):
"""
x 的父亲为 y;x 的权重为 y 的权重 + weight_offset
:param x:
:param y:
:param weight_offset:
:return:
"""
self.find(x)
self.find(y)
if x == y:
return
if self.nodes[x].tree_size > self.nodes[y].tree_size:
x, y = y, x
weight_offset = -weight_offset
wx, wy = self.nodes[x].weight, self.nodes[y].weight
weight_offset += wy - wx
x,y = self.nodes[x].parent, self.nodes[y].parent
self.nodes[x].parent = y
self.nodes[x].weight = weight_offset % 3
self.nodes[y].tree_size += self.nodes[x].tree_size
if __name__ == '__main__':
animals_amount, instructions_amount = map(int, input().split())
dsu = Dsu(animals_amount)
lies_amount = 0
for _ in range(instructions_amount):
instruction_type, animal1, animal2 = map(int, input().split())
# print(instruction_type, animal1, animal2, file=sys.stderr)
if animal1 > animals_amount or animal2 > animals_amount:
print("Lie: No animal", file=sys.stderr)
lies_amount += 1
continue
if animal1 == animal2:
if instruction_type == 2:
print("Lie: Eats oneself", file=sys.stderr)
lies_amount += 1
continue
animal1 -= 1
animal2 -= 1
if dsu.find(animal1) == dsu.find(animal2):
w1 = dsu.nodes[animal1].weight
w2 = dsu.nodes[animal2].weight
if instruction_type == 1 and w1 != w2:
print("Lie: different type", w1, w2, file=sys.stderr)
lies_amount += 1
if instruction_type == 2 and (w1 - w2 + 12) % 3 != 1:
print("Lie: cannot eat", w1, w2, file=sys.stderr)
lies_amount += 1
else:
dsu.union(animal1, animal2, instruction_type - 1)
# print("Success", file=sys.stderr)
print(lies_amount)
+10
View File
@@ -0,0 +1,10 @@
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
return 0;
}
+56
View File
@@ -0,0 +1,56 @@
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
constexpr size_t MAX_N = 4005;
long long numbers_amount, numbers[4][MAX_N];
vector<long long> sums[2];
unordered_map<long long, size_t> sum_to_amount[2];
template <typename T>
void log_vector(vector<T> vec, const string& prefix = "") {
clog << prefix;
for (const T& n : vec) {
clog << n << " ";
}
clog << endl;
}
void build_sums(const size_t sums_idx) {
for (int i = 0; i < numbers_amount; i++) {
for (int j = 0; j < numbers_amount; j++) {
long long sum = numbers[sums_idx][i] + numbers[sums_idx + 1][j];
if (!sum_to_amount[sums_idx / 2][sum]++) {
sums[sums_idx / 2].push_back(sum);
}
}
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> numbers_amount;
for (int i = 0; i < numbers_amount; i++) {
cin >> numbers[0][i] >> numbers[1][i] >> numbers[2][i] >> numbers[3][i];
}
build_sums(0), build_sums(2);
sort(sums[0].begin(), sums[0].end()), sort(sums[1].begin(), sums[1].end());
// log_vector(sums[0], "sums[0]: ");
// log_vector(sums[1], "sums[1]: ");
unsigned int ans = 0;
for (const long long n : sums[0]) {
auto it = lower_bound(sums[1].begin(), sums[1].end(), -n);
if (it != sums[1].end() && *it == -n) {
ans += sum_to_amount[1][-n] * sum_to_amount[0][n];
}
}
cout << ans << endl;
return 0;
}
+35
View File
@@ -0,0 +1,35 @@
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int get_max_sum(const vector<int>& vec) {
vector<int> max_sums(vec.size());
max_sums[0] = vec[0];
for (int i = 1; i < vec.size(); i++) {
int max_sum = 0;
for (int j = 0; j < i; j++) {
if (vec[j] < vec[i]) {
max_sum = max(max_sum, max_sums[j]);
}
}
max_sums[i] = max_sum + vec[i];
}
return *max_element(max_sums.begin(), max_sums.end());
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int numbers_amount;
cin >> numbers_amount;
vector<int> numbers(numbers_amount);
for (int i = 0; i < numbers_amount; i++) {
cin >> numbers[i];
}
cout << get_max_sum(numbers) << endl;
return 0;
}
+51
View File
@@ -0,0 +1,51 @@
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
struct Bracket {
bool is_right;
size_t index;
bool operator<(const Bracket& other) const {
return index < other.index;
}
};
string get_unmatched_brackets_string(const string& s) {
stack<Bracket> brackets;
vector<Bracket> unmatched_brackets;
string printed_string(s.size(), ' ');
for (size_t i = 0; i < s.size(); i++) {
if (s[i] == '(') {
brackets.push({.is_right = false, .index = i});
} else if (s[i] == ')') {
if (brackets.empty()) {
unmatched_brackets.push_back({.is_right = true, .index = i});
} else {
brackets.pop();
}
}
}
while (!brackets.empty()) {
unmatched_brackets.push_back(brackets.top());
brackets.pop();
}
for (const auto& [is_right, index] : unmatched_brackets) {
printed_string[index] = is_right ? '?' : '$';
}
return printed_string;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s;
while (getline(cin, s) && !s.empty()) {
cout << s << endl << get_unmatched_brackets_string(s) << endl;
}
return 0;
}
+33 -21
View File
@@ -29,42 +29,54 @@ vector<int> get_divisors(const int n) {
return small_divisors; return small_divisors;
} }
/// 需要保证 sorted_cut_sticks 有序;需要保证 target_length 是总长度的因数
bool verify_length_dfs(const vector<int>& sorted_cut_sticks, bool verify_length_dfs(const vector<int>& sorted_cut_sticks,
const int target_length, const int target_length,
const int remaining_length,
const int original_sticks,
const int remaining_sticks, const int remaining_sticks,
vector<bool>& used) { size_t global_right_idx,
if (target_length == 0) { return true; } const size_t right_idx,
if (target_length < 0) { return false; } vector<bool>& used
// if (sorted_cut_sticks.empty()) { throw logic_error("Invalid target_times"); } ) {
// if (sorted_cut_sticks.empty()) { return true; } // clog << "verify_length_dfs(" << target_length << ") " << remaining_length << " " << remaining_sticks << "x " <<
// if (sorted_cut_sticks.back() > target_length) { return false; } // global_right_idx << "->" << right_idx << endl;
// while (!sorted_cut_sticks.empty() && sorted_cut_sticks.back() >= target_length) { // log_vector(used, "used: ");
// sorted_cut_sticks.pop_back(); // 直接用 if (remaining_sticks == 0) { return true; }
// } bool result = false;
// if (sorted_cut_sticks.empty()) { return true; } for (int i = static_cast<int>(right_idx); i >= 0; i--) {
if (target_length < sorted_cut_sticks[i]) { return false; }
const int remaining_length = target_length;
for (int i = static_cast<int>(sorted_cut_sticks.size()) - 1; i >= 0; i--) {
if (sorted_cut_sticks[i] > target_length) { return false; }
if (used[i]) { continue; } if (used[i]) { continue; }
if (sorted_cut_sticks[i] > remaining_length) { continue; } if (remaining_length < sorted_cut_sticks[i]) { continue; }
used[i] = true; used[i] = true;
if (verify_length_dfs(sorted_cut_sticks, remaining_length - sorted_cut_sticks[i], remaining_sticks, used)) { if (remaining_length == sorted_cut_sticks[i]) { // 下一根
return true; result = verify_length_dfs(sorted_cut_sticks, target_length, target_length, original_sticks,
remaining_sticks - 1, global_right_idx,
global_right_idx, used);
} else { // 这一根
if (remaining_length == target_length) { // 这一根的第一节
global_right_idx = i;
}
result = verify_length_dfs(sorted_cut_sticks, target_length,
remaining_length - sorted_cut_sticks[i], original_sticks,
remaining_sticks, global_right_idx, i, used);
} }
if (result) { return true; }
used[i] = false; used[i] = false;
// 剪枝 while (i >= 0 && sorted_cut_sticks[i] == sorted_cut_sticks[i - 1]) { i--; } // 剪枝
// if (remaining_sticks == original_sticks && remaining_length == target_length) { return false; } // 剪枝
if (remaining_length == target_length) { return false; } // 剪枝
} }
return false; return false;
} }
/// 需要保证 sorted_cut_sticks 有序;需要保证 target_length * remaining_sticks = 总长度
bool verify_length_dfs(const vector<int>& sorted_cut_sticks, bool verify_length_dfs(const vector<int>& sorted_cut_sticks,
const int target_length, const int target_length,
const int remaining_sticks) { const int remaining_sticks) {
vector<bool> used(sorted_cut_sticks.size(), false); vector<bool> used(sorted_cut_sticks.size(), false);
bool result = verify_length_dfs(sorted_cut_sticks, target_length, remaining_sticks, used); bool result = verify_length_dfs(sorted_cut_sticks, target_length, target_length, remaining_sticks,
log_vector(used, "used: "); remaining_sticks, sorted_cut_sticks.size() - 1, sorted_cut_sticks.size() - 1, used);
// log_vector(used, "used: ");
return result; return result;
} }