Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π λ¬Έμ λ§ν¬
λ°±μ€ - μν λ리기
https://www.acmicpc.net/problem/17822
βοΈ μμλ μκ°
1μκ°
β¨ μλ μ½λ
ν΄λΉ λ¬Έμ λ,
μ£Όμ΄μ§ μνμμ νμ μν€κ³ , μΈμ ν μ μλΌλ¦¬ μμ λμ§,
νμ μν€κ³ , μΈμ ν μ μκ° μμΌλ©΄ νκ· μΌλ‘ μΉννλ©°
μ΅μ’ μνμμ μ ν μ μμ ν©μ μΆλ ₯νλ λ¬Έμ μ λλ€.
λ¨Όμ μν μ μλ€μ μ λ ₯λ°μ΅λλ€.
μ΄ν μ£Όμ΄μ§ κ°μ λ°λΌ νμ μ μμΌμ€λλ€.
νμ νμμ μμ§ μ«μκ° λ¨μμλμ§ νμΈν©λλ€.
λ§μ½ μ«μκ° λ¨μμκ³ ,
μΈμ ν κ°μ μ«μκ° μ‘΄μ¬νλ€λ©΄ 0μΌλ‘ λ§λ€μ΄μ€λλ€.
λ§μ½ λ§μ½ μ«μκ° λ¨μμκ³ ,
μΈμ ν κ°μ μ«μκ° μλ€λ©΄ νκ· κ°μΌλ‘ μΉνν΄ μ€λλ€.
μ£Όμ΄μ§ νμ μ λ€ λ§μ³€μΌλ©΄, νμ νμ μλ μ«μλ€μ ν©μ μΆλ ₯ν΄μ€λλ€.
μνμ μ«μλ₯Ό λ리λ λ°©λ²μ κ°λ¨ν©λλ€.
μ£Όμ΄μ§ μκ³λ°©ν₯μ λ§μΆ° μ£Όμ΄μ§ λ§νΌ μ΄λμν΅λλ€.
μΈμ ν μ«μλ₯Ό μ°Ύμ 0μΌλ‘ λ§λλ μμ μ
μ΄μμ λ¨Όμ μΈμ μ νμΈνκ³ , μ΄ν νμμ μΈμ μ νμΈνμ¬ 0μΌλ‘ μΉνν΄μ£Όλ©΄ λ©λλ€.
π μλ‘κ² μκ²λ λ΄μ©
빑ꡬνμμ μ£Όμ΄μ§ μμλλ‘ μ°¨κ·Όμ°¨κ·Ό ꡬνν λ
λ©μΈ λ©μλμμ μΌλ¨ μμμ λ©μλλ₯Ό νΈμΆνλλ‘ νκ³ λμ μ΄νμ μμΈν ꡬνμ νλ λ°©μμΌλ‘ νλκ² κ°μ₯ λΉ λ₯Έ λ°©λ²μΈ κ² κ°μ΅λλ€.