This commit is contained in:
2026-07-28 00:33:27 +08:00
parent 2b6dc69bde
commit 8bc1b22a1c
14 changed files with 529 additions and 124 deletions
+6 -1
View File
@@ -1,2 +1,7 @@
.venv .venv
*.exe /*.exe
# 忽略 linux 编译产物
/*
!/*.*
!*/
+5
View File
@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="默认_mod" />
</state>
</component>
+5 -88
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="HINT" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="DO_NOT_SHOW" 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" />
@@ -250,101 +250,18 @@
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALLOW_COMMENT_AFTER_LBRACE/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/EMPTY_BLOCK_STYLE/@EntryValue" value="TOGETHER_SAME_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" /> <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/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_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/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/REQUIRES_EXPRESSION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
</component> </component>
</project> </project>
+2
View File
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CIDR" type="CPP_MODULE" version="4" />
+1
View File
@@ -1,6 +1,7 @@
<component name="InspectionProjectProfileManager"> <component name="InspectionProjectProfileManager">
<profile version="1.0"> <profile version="1.0">
<option name="myName" value="Project Default" /> <option name="myName" value="Project Default" />
<inspection_tool class="CppTemplateArgumentsCanBeDeduced" enabled="false" level="HINT" enabled_by_default="false" />
<inspection_tool class="CppUseInternalLinkage" enabled="false" level="WEAK WARNING" enabled_by_default="false" /> <inspection_tool class="CppUseInternalLinkage" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
</profile> </profile>
</component> </component>
+96 -34
View File
@@ -4,19 +4,46 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="BackendCodeEditorMiscSettings"> <component name="BackendCodeEditorMiscSettings">
<option name="/Default/Environment/Hierarchy/GeneratedFilesCacheKey/Timestamp/@EntryValue" value="8" type="long" />
<option name="/Default/Housekeeping/FeatureSuggestion/FeatureSuggestionManager/DisabledSuggesters/=SwitchToGoToActionSuggester/@EntryIndexedValue" value="true" type="bool" /> <option name="/Default/Housekeeping/FeatureSuggestion/FeatureSuggestionManager/DisabledSuggesters/=SwitchToGoToActionSuggester/@EntryIndexedValue" value="true" type="bool" />
<option name="/Default/Housekeeping/LiveTemplatesHousekeeping/HotspotSessionHintIsShown/@EntryValue" value="true" type="bool" /> <option name="/Default/Housekeeping/LiveTemplatesHousekeeping/HotspotSessionHintIsShown/@EntryValue" value="true" type="bool" />
<option name="/Default/Housekeeping/OptionsDialog/SelectedPageId/@EntryValue" value="CppFormatterOtherPage" type="string" /> <option name="/Default/Housekeeping/OptionsDialog/SelectedPageId/@EntryValue" value="CppFormatterOtherPage" type="string" />
</component> </component>
<component name="CMakePresetLoader">{
&quot;useNewFormat&quot;: true
}</component>
<component name="CMakeProjectFlavorService">
<option name="flavorId" value="CMakePlainProjectFlavor" />
</component>
<component name="CMakeReloadState">
<option name="reloaded" value="true" />
</component>
<component name="CMakeRunConfigurationManager">
<generated>
<config projectName="Project" targetName="exercises" />
</generated>
</component>
<component name="CMakeSettings">
<configurations>
<configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="4491295e-723c-4e0b-b7b4-9be1cbde5db8" name="更改" comment=""> <list default="true" id="4491295e-723c-4e0b-b7b4-9be1cbde5db8" name="更改" comment="fix gitignore">
<change afterPath="$PROJECT_DIR$/lc_127.py" afterDir="false" /> <change afterPath="$PROJECT_DIR$/.idea/codeStyles/codeStyleConfig.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pojcs101_M01017_6_boxes.cpp" afterDir="false" /> <change afterPath="$PROJECT_DIR$/.idea/exercises.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pojcs101_M02692_12_coins.cpp" afterDir="false" /> <change afterPath="$PROJECT_DIR$/pojcs101_M01088_ski.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pojcs101_M02692_12_coins_WRONG.cpp" afterDir="false" /> <change afterPath="$PROJECT_DIR$/pojcs101_M01088_ski_WRONG.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/exercises.iml" beforeDir="false" /> <change afterPath="$PROJECT_DIR$/pojcs101_M01321_chest_grid.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pojcs101_M01328_radar_greedy.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pojcs101_M01328_radar_greedy_WRONG.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pojcs101_M01852_ants_falling.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pojcs101_M01922_ride_follower.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/editor.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/editor.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.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$/pojcs101_M01002.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/pojcs101_M01002_memorable_number.cpp" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pojcs101_M01002_memorable_number.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/pojcs101_M01002_memorable_number.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" />
@@ -25,10 +52,12 @@
</component> </component>
<component name="ClangdSettings"> <component name="ClangdSettings">
<option name="formatViaClangd" value="false" /> <option name="formatViaClangd" value="false" />
<option name="clangWarnings" value="-Wno-unused-variable,-Wno-infinite-recursion,-Wno-array-bounds,-Wno-return-stack-address,-Werror=implicit-function-declaration,-Wshadow,-Wno-shadow-field-in-constructor-modified,-Wno-shadow-ivar,-Wuninitialized,-Wunused-label,-Wunused-lambda-capture,-std=c++17" />
</component> </component>
<component name="CurrentDebugProfile"> <component name="CurrentDebugProfile">
<option name="debugProfileId" value="e77b0a9f-756a-4aba-8623-5e4caeda05ed" /> <option name="debugProfileId" value="2c1c9069-eeff-46e4-9092-db62e2b1ded5" />
</component> </component>
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
<component name="FileTemplateManagerImpl"> <component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES"> <option name="RECENT_TEMPLATES">
<list> <list>
@@ -38,11 +67,22 @@
</option> </option>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="main" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="MacroExpansionManager"> <component name="MacroExpansionManager">
<option name="directoryName" value="7Sv2hfws" /> <option name="directoryName" value="7Sv2hfws" />
</component> </component>
<component name="ProjectApplicationVersion">
<option name="ide" value="CLion" />
<option name="majorVersion" value="2026" />
<option name="minorVersion" value="2.0.1" />
<option name="productBranch" value="Classic" />
</component>
<component name="ProjectColorInfo">{ <component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;, &quot;customColor&quot;: &quot;&quot;,
&quot;associatedIndex&quot;: 6 &quot;associatedIndex&quot;: 6
@@ -54,6 +94,7 @@
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent"><![CDATA[{
"keyToString": { "keyToString": {
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
"C/C++ 文件.D_pojcs101_M02692.cpp.executor": "Run", "C/C++ 文件.D_pojcs101_M02692.cpp.executor": "Run",
"C/C++ 文件.luogu_UVA755.cpp.executor": "Run", "C/C++ 文件.luogu_UVA755.cpp.executor": "Run",
"C/C++ 文件.luogu_ez_B3628.cpp.executor": "Run", "C/C++ 文件.luogu_ez_B3628.cpp.executor": "Run",
@@ -61,20 +102,30 @@
"C/C++ 文件.ojcs101_E01218.cpp.executor": "Run", "C/C++ 文件.ojcs101_E01218.cpp.executor": "Run",
"C/C++ 文件.ojcs101_E02883.cpp.executor": "Run", "C/C++ 文件.ojcs101_E02883.cpp.executor": "Run",
"C/C++ 文件.pojcs101_M01017_6_boxes.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_M02692.cpp.executor": "Run", "C/C++ 文件.pojcs101_M02692.cpp.executor": "Run",
"C/C++ 文件.pojcs101_M02692_12_coins.cpp.executor": "Run",
"CMake 应用程序.exercises.executor": "Run",
"CidrDebugProfileConversion": "true", "CidrDebugProfileConversion": "true",
"ModuleVcsDetector.initialDetectionPerformed": "true", "ModuleVcsDetector.initialDetectionPerformed": "true",
"Python.lc_127.executor": "Run", "Python.lc_127.executor": "Run",
"RunOnceActivity.RadMigrateCodeStyle": "true", "RunOnceActivity.RadMigrateCodeStyle": "true",
"RunOnceActivity.ShowReadmeOnStart": "true", "RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.cidr.known.project.marker": "true", "RunOnceActivity.cidr.known.project.marker": "true",
"RunOnceActivity.git.unshallow": "true",
"RunOnceActivity.readMode.enableVisualFormatting": "true", "RunOnceActivity.readMode.enableVisualFormatting": "true",
"RunOnceActivity.typescript.service.memoryLimit.init": "true", "RunOnceActivity.typescript.service.memoryLimit.init": "true",
"RunOnceActivity.west.config.association.type.startup.service": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"cf.first.check.clang-format": "false", "cf.first.check.clang-format": "false",
"cidr.known.project.marker": "true", "cidr.known.project.marker": "true",
"codeWithMe.voiceChat.enabledByDefault": "false", "codeWithMe.voiceChat.enabledByDefault": "false",
"git-widget-placeholder": "main", "git-widget-placeholder": "main",
"last_opened_file_path": "E:/Projects/exercises", "last_opened_file_path": "/Users/roger/coding/exercises",
"node.js.detected.package.jshint": "true", "node.js.detected.package.jshint": "true",
"node.js.selected.package.jshint": "", "node.js.selected.package.jshint": "",
"nodejs_package_manager_path": "npm", "nodejs_package_manager_path": "npm",
@@ -82,43 +133,37 @@
"settings.editor.selected.configurable": "preferences.sourceCode.C++" "settings.editor.selected.configurable": "preferences.sourceCode.C++"
} }
}]]></component> }]]></component>
<component name="RunManager" selected="C/C++ 文件.pojcs101_M01017_6_boxes.cpp"> <component name="RecentsManager">
<configuration name="D_pojcs101_M02692.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="D_pojcs101_M02692.cpp" CONFIG_NAME="D_pojcs101_M02692.cpp"> <key name="CopyFile.RECENT_KEYS">
<option name="sourceFile" value="D_pojcs101_M02692.cpp" /> <recent name="$PROJECT_DIR$" />
</key>
</component>
<component name="RunManager" selected="C/C++ 文件.pojcs101_M01922_ride_follower.cpp">
<configuration name="pojcs101_M01328_radar_greedy.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_M01328_radar_greedy.cpp" CONFIG_NAME="pojcs101_M01328_radar_greedy.cpp">
<option name="sourceFile" value="pojcs101_M01328_radar_greedy.cpp" />
<method v="2"> <method v="2">
<option name="com.jetbrains.cidr.cpp.runfile.CppFileBuildBeforeRunTaskProvider$BasicBuildBeforeRunTask" enabled="true" /> <option name="com.jetbrains.cidr.cpp.runfile.CppFileBuildBeforeRunTaskProvider$BasicBuildBeforeRunTask" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration name="luogu_UVA755.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="luogu_UVA755.cpp" CONFIG_NAME="luogu_UVA755.cpp"> <configuration name="pojcs101_M01852_ants_falling.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_M01852_ants_falling.cpp" CONFIG_NAME="pojcs101_M01852_ants_falling.cpp">
<option name="sourceFile" value="luogu_UVA755.cpp" /> <option name="sourceFile" value="pojcs101_M01852_ants_falling.cpp" />
<method v="2"> <method v="2">
<option name="com.jetbrains.cidr.cpp.runfile.CppFileBuildBeforeRunTaskProvider$BasicBuildBeforeRunTask" enabled="true" /> <option name="com.jetbrains.cidr.cpp.runfile.CppFileBuildBeforeRunTaskProvider$BasicBuildBeforeRunTask" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration name="ojcs101_E01218.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="ojcs101_E01218.cpp" CONFIG_NAME="ojcs101_E01218.cpp"> <configuration name="pojcs101_M01922_ride_follower.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_M01922_ride_follower.cpp" CONFIG_NAME="pojcs101_M01922_ride_follower.cpp">
<option name="sourceFile" value="ojcs101_E01218.cpp" /> <option name="sourceFile" value="pojcs101_M01922_ride_follower.cpp" />
<method v="2">
<option name="com.jetbrains.cidr.cpp.runfile.CppFileBuildBeforeRunTaskProvider$BasicBuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ojcs101_E02883.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="ojcs101_E02883.cpp" CONFIG_NAME="ojcs101_E02883.cpp">
<option name="sourceFile" value="ojcs101_E02883.cpp" />
<method v="2">
<option name="com.jetbrains.cidr.cpp.runfile.CppFileBuildBeforeRunTaskProvider$BasicBuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="pojcs101_M01017_6_boxes.cpp" type="CppFileRunConfiguration" factoryName="CppFileRunConfiguration" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="exercises" TARGET_NAME="pojcs101_M01017_6_boxes.cpp" CONFIG_NAME="pojcs101_M01017_6_boxes.cpp">
<option name="sourceFile" value="pojcs101_M01017_6_boxes.cpp" />
<method v="2">
<option name="com.jetbrains.cidr.cpp.runfile.CppFileBuildBeforeRunTaskProvider$BasicBuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="pojcs101_M02692.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_M02692.cpp" CONFIG_NAME="pojcs101_M02692.cpp">
<option name="sourceFile" value="pojcs101_M02692.cpp" />
<method v="2"> <method v="2">
<option name="com.jetbrains.cidr.cpp.runfile.CppFileBuildBeforeRunTaskProvider$BasicBuildBeforeRunTask" enabled="true" /> <option name="com.jetbrains.cidr.cpp.runfile.CppFileBuildBeforeRunTaskProvider$BasicBuildBeforeRunTask" enabled="true" />
</method> </method>
</configuration> </configuration>
<recent_temporary>
<list>
<item itemvalue="C/C++ 文件.pojcs101_M01922_ride_follower.cpp" />
<item itemvalue="C/C++ 文件.pojcs101_M01852_ants_falling.cpp" />
<item itemvalue="C/C++ 文件.pojcs101_M01328_radar_greedy.cpp" />
</list>
</recent_temporary>
</component> </component>
<component name="SharedIndexes"> <component name="SharedIndexes">
<attachedChunks> <attachedChunks>
@@ -142,10 +187,27 @@
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>
<component name="VCPKGProject">
<isAutomaticCheckingOnLaunch value="false" />
<isAutomaticFoundErrors value="true" />
<isAutomaticReloadCMake value="true" />
<isAutomaticBootstrapAfterUpdate value="false" />
</component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="1" /> <MESSAGE value="1" />
<option name="LAST_COMMIT_MESSAGE" value="1" /> <option name="LAST_COMMIT_MESSAGE" value="1" />
</component> </component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
<url>file://$PROJECT_DIR$/pojcs101_M01321_chest_grid.cpp</url>
<line>44</line>
<option name="timeStamp" value="2" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
<component name="XSLT-Support.FileAssociations.UIState"> <component name="XSLT-Support.FileAssociations.UIState">
<expand /> <expand />
<select /> <select />
-1
View File
@@ -40,7 +40,6 @@ void runDataset() {
if (noDuplicate) { if (noDuplicate) {
std::cout << "No duplicates." << std::endl; std::cout << "No duplicates." << std::endl;
} }
// std::cout << std::endl;
} }
int main() { int main() {
+76
View File
@@ -0,0 +1,76 @@
#include <iostream>
#include <vector>
using namespace std;
constexpr int DX[] = {0, 1, 0, -1};
constexpr int DY[] = {1, 0, -1, 0};
int path_length = 0;
void log_grid(const vector<vector<int>>& grid, string name) {
for (const auto& row : grid) {
clog << name << ": ";
for (const auto& cell : row) {
clog << cell << " ";
}
clog << endl;
}
}
int dfs(const vector<vector<int>>& grid, const int x, const int y,
vector<vector<int>>& calculated_depths, const int _depth = 1) {
const unsigned int r = grid.size(), c = grid[0].size();
const int current_num = grid[x][y];
if (calculated_depths[x][y] > 0) { return calculated_depths[x][y] + _depth - 1; }
if (_depth + current_num <= path_length) {
// clog << "CUT " << x << "," << y << ":" << current_num << ", " << _depth << endl;
return -1;
} // 剪枝
// if (current_num == 1) { return _depth; }
// clog << x << "," << y << ":" << current_num << ", " << _depth << endl;
int best_depth = _depth;
for (int i = 0; i < 4; i++) {
const int nx = x + DX[i], ny = y + DY[i];
if (nx >= 0 && nx < r && ny >= 0 && ny < c && grid[nx][ny] < current_num) {
int next_depth = dfs(grid, nx, ny, calculated_depths, _depth + 1);
best_depth = max(best_depth, next_depth);
}
}
path_length = max(path_length, best_depth);
calculated_depths[x][y] = best_depth - _depth + 1;
return best_depth;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int r, c;
cin >> r >> c;
vector<vector<int>> grid(r, vector<int>(c));
vector<vector<int>> calculated_depths(r, vector<int>(c, 0));
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
cin >> grid[i][j];
}
}
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
dfs(grid, i, j, calculated_depths);
// clog << "---" << endl;
// log_grid(calculated_depths, "calculated_depths");
// clog << "---" << endl;
}
}
cout << path_length << endl;
return 0;
}
+49
View File
@@ -0,0 +1,49 @@
#include <iostream>
#include <vector>
using namespace std;
constexpr int DX[] = {0, 1, 0, -1};
constexpr int DY[] = {1, 0, -1, 0};
int longest_path(const vector<vector<int> > &grid, int x = -1, int y = -1, int depth = 0) {
const unsigned int r = grid.size(), c = grid[0].size();
if (x == -1 && y == -1) {
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
if (grid[i][j] == r * c) {
x = i, y = j, depth = 1;
break;
}
}
}
}
for (int i = 0; i < 4; i++) {
int nx = x + DX[i], ny = y + DY[i];
if (nx >= 0 && nx < grid.size() && ny >= 0 && ny < grid[0].size()
&& grid[nx][ny] == grid[x][y] - 1) {
return longest_path(grid, nx, ny, depth + 1);
}
}
return depth;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int r, c;
cin >> r >> c;
vector<vector<int> > grid(r, vector<int>(c));
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
cin >> grid[i][j];
}
}
cout << longest_path(grid) << endl;
return 0;
}
+71
View File
@@ -0,0 +1,71 @@
#include <iostream>
#include <vector>
using namespace std;
void log_array(const vector<bool>& arr, const string& name) {
clog << name << ": ";
for (const auto& cell : arr) {
clog << cell << " ";
}
clog << endl;
}
vector<vector<bool>> get_grid(const int size) {
vector<vector<bool>> grid;
for (int _ = 0; _ < size; _++) {
string pattern;
vector<bool> row;
cin >> pattern;
for (const char c : pattern) { row.push_back(c != '.'); }
grid.push_back(row);
}
return grid;
}
long long dfs(const vector<vector<bool>>& grid,
const int remaining_chests,
const int curr_empty_row,
vector<bool>& col_occupation) {
const unsigned int size = grid[0].size();
if (remaining_chests == 0) { return 1; }
if (curr_empty_row >= size) { return 0; }
// clog << "curr_empty_row: " << curr_empty_row << endl;
// log_array(col_occupation, "col_occupation");
long long ans = 0;
for (int col = 0; col < size; col++) { // 这行放
if (!grid[curr_empty_row][col]) { continue; }
if (col_occupation[col]) { continue; }
// vector<bool> new_col_occupation(col_occupation);
col_occupation[col] = true;
ans += dfs(grid, remaining_chests - 1, curr_empty_row + 1, col_occupation);
col_occupation[col] = false;
}
ans += dfs(grid, remaining_chests, curr_empty_row + 1, col_occupation); // 不在这行放
return ans;
}
long long dfs(const vector<vector<bool>>& grid,
const int remaining_chests,
const int curr_empty_row = 0) {
vector<bool> col_occupation(grid[0].size(), false);
return dfs(grid, remaining_chests, curr_empty_row, col_occupation);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int size, chest_count;
while (cin >> size >> chest_count) {
if (size < 0) { break; }
vector<vector<bool>> grid = get_grid(size);
cout << dfs(grid, chest_count) << endl;
}
// cin >> size;
// chest_count = size;
// const vector<vector<bool>> grid = get_grid(size);
// cout << dfs(grid, chest_count) << endl;
return 0;
}
+59
View File
@@ -0,0 +1,59 @@
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
double other_leg(const double leg, const double diag) {
return sqrt(diag * diag - leg * leg);
}
double diag(const double leg1, const double leg2) {
return sqrt(leg1 * leg1 + leg2 * leg2);
}
vector<pair<double, double>> target_ranges(vector<pair<int, int>> islands, const int distance) {
vector<pair<double, double>> ranges;
for (auto& [island_x, island_y] : islands) {
if (island_y > distance) { throw std::runtime_error("Island is too far away from the radar."); }
const double offset = other_leg(island_y, distance);
ranges.emplace_back(island_x - offset, island_x + offset);
}
sort(ranges.begin(), ranges.end(),
[](const auto& a, const auto& b) { return a.second < b.second; });
return ranges;
}
int required_radars(const vector<pair<double, double>>& ranges) {
if (ranges.empty()) { return 0; }
int answer = 1;
double current_max_x = ranges[0].second;
for (const auto& [left,right] : ranges) {
if (left > current_max_x) { answer++, current_max_x = right; } // 放不下,加雷达
else if (right < current_max_x) { current_max_x = right; } // 放下,需要左移雷达
clog << "current_max_x: " << current_max_x << " answer: " << answer << endl;
}
return answer;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, distance, case_id = 0;
while (cin >> n >> distance) {
if (n == 0 && distance == 0) { break; }
vector<pair<int, int>> islands(n);
for (int i = 0; i < n; i++) {
cin >> islands[i].first >> islands[i].second;
}
// cout << "Case " << ++case_id << ": ";
try {
cout << required_radars(target_ranges(islands, distance)) << endl;
} catch (std::runtime_error&) {
cout << -1 << endl;
}
}
}
+61
View File
@@ -0,0 +1,61 @@
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
double other_leg(const double leg, const double diag) {
return sqrt(diag * diag - leg * leg);
}
double diag(const double leg1, const double leg2) {
return sqrt(leg1 * leg1 + leg2 * leg2);
}
int required_radars(vector<pair<int, int>> islands, int distance) {
for (auto& [island_x, island_y] : islands) {
if (island_y > distance) { return -1; }
}
sort(islands.begin(), islands.end());
int answer = 0;
while (!islands.empty()) {
answer++;
const auto current_island = islands.back();
islands.pop_back();
double min_x = current_island.first
- other_leg(current_island.second, distance)
- current_island.second;
vector<pair<int, int>> uncovered_islands;
while (!islands.empty() && islands.back().first >= min_x) {
// 右移雷达
const double offset = other_leg(islands.back().second, distance);
if (islands.back().first - offset >= min_x) {
min_x = islands.back().first - offset;
} else {
uncovered_islands.push_back(islands.back());
}
islands.pop_back();
}
for (int i = uncovered_islands.size() - 1; i >= 0; i--) { // NOLINT(*-narrowing-conversions)
islands.push_back(uncovered_islands[i]);
}
}
return answer;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, distance, case_id = 0;
while (cin >> n >> distance) {
if (n == 0 && distance == 0) { break; }
vector<pair<int, int>> islands(n);
for (int i = 0; i < n; i++) {
cin >> islands[i].first >> islands[i].second;
}
cout << "Case " << ++case_id << ": " << required_radars(islands, distance) << endl;
}
}
+40
View File
@@ -0,0 +1,40 @@
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int shortest_fall_time(const int length, vector<int> ant_pos) {
sort(ant_pos.begin(), ant_pos.end(),
[length](const int pos1, const int pos2) {
return abs(pos1 - length / 2) < abs(pos2 - length / 2); // 到中点距离最短者
});
return min(ant_pos[0], length - ant_pos[0]);
}
int longest_fall_time(const int length, vector<int> ant_pos) {
sort(ant_pos.begin(), ant_pos.end(),
[length](const int pos1, const int pos2) {
return abs(pos1 - length / 2) > abs(pos2 - length / 2); // 到中点距离最长者
});
return max(ant_pos[0], length - ant_pos[0]);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int group_count;
cin >> group_count;
for (int _ = 0; _ < group_count; _++) {
int length, ant_count;
cin >> length >> ant_count;
vector<int> ant_pos(ant_count);
for (int i = 0; i < ant_count; i++) {
cin >> ant_pos[i];
}
cout << shortest_fall_time(length, ant_pos) << " " << longest_fall_time(length, ant_pos) << endl;
}
return 0;
}
+58
View File
@@ -0,0 +1,58 @@
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef pair<int, int> Rider;
constexpr int FULL_DISTANCE = 4500 * 3.6;
int ride_time(const Rider& rider, const int distance = FULL_DISTANCE) {
return static_cast<int>(ceil(static_cast<double>(distance) / rider.first)) + rider.second;
}
int start_pos(const Rider& rider) {
if (rider.second >= 0) { return 0; }
return rider.first * -rider.second;
}
int arrival_time(const vector<Rider>& riders, const int distance = FULL_DISTANCE) {
vector<Rider> early_riders, late_riders;
for (const auto& rider : riders) {
if (rider.second >= 0) {
late_riders.push_back(rider);
} else {
// early_riders.push_back(rider);
}
}
double min_time = ride_time(*min_element(
late_riders.begin(), late_riders.end(),
[distance](const Rider& a, const Rider& b) {
return ride_time(a, distance) < ride_time(b, distance);
}));
clog << "min_time: " << min_time << endl;
// for (const auto& rider : early_riders) {
// if (-rider.second > min_time) { continue; }
// min_time = min(min_time, ride_time(rider, distance));
// }
return static_cast<int>(ceil(min_time));
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int rider_count;
while (cin >> rider_count && rider_count) {
vector<Rider> riders(rider_count);
for (int i = 0; i < rider_count; i++) {
cin >> riders[i].first >> riders[i].second;
// riders[i].first /= 3.6;
}
cout << arrival_time(riders) << endl;
}
return 0;
}