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.
๐ ๋ฌธ์ ๋งํฌ
Robot Collisions
โ๏ธ ์์๋ ์๊ฐ
5์๊ฐ
โจ ์๋ ์ฝ๋
ํ์ด ๋ฐฉ๋ฒ
position
๊ณผhealths
๊ทธ๋ฆฌ๊ณdirections
๊ฐ ์ค๋ค. ๊ฐ ๋ฐฐ์ด์ ์ธ๋ฑ์ค๋ ํ๋์ ๋ก๋ด์ ์์น, ์ฒด๋ ฅ, ๋ฐฉํฅ์ ๊ฐ๋ฆฌํจ๋ค.๋ก๋ด์
directions
์ ์ฃผ์ด์ง ๋ฐฉํฅ์ผ๋ก ๊ฐ๊ฒ๋๋ฉฐ ๋ถ๋ซํ๋ ๊ฒฝ์ฐ. ์ฒด๋ ฅ์ด ์ ์ ๋ก๋ด์healths
๊ฐ 0์ด ๋๊ณ ์ฒด๋ ฅ์ด ๋ง์ ๋ก๋ด์ 1 ๊น์ธ๋ค.๊ฐ์ ๊ฒฝ์ฐ์๋ ๋๋ค
healths
๊ฐ 0์ด ๋๋ค.์ฒซ๋ฒ์งธ ํ์ด๋ฐฉ์
์ผ์ชฝ, ์ค๋ฅธ์ชฝ์ผ๋ก ์ด๋ํ๋ ๋ก๋ด๋ค์ ์ฐ์ ์์ ํ์ ๋ฃ์ด์ค๋ค.
์ค๋ฅธ์ชฝ์ผ๋ก ์ด๋ํ๋ ๋ก๋ด์ ๋ด๋ฆผ์ฐจ์์ผ๋ก,
์ผ์ชฝ์ผ๋ก ์ด๋ํ๋ ๋ก๋ด์ ์ค๋ฆ์ฐจ์์ผ๋ก ์ ๋ ฌํด์ค๋ค.
R = { 5, 4, 3, 2, 1 }
L = { 6, 7, 9, 10}
๊ณผ ๊ฐ์ ํ์.
healths
๋ฐฐ์ด์ ๊ฐ์ ๋ณ๊ฒฝํด์ค๋ค.healths
์ ๊ฐ์ด 0์ด ์๋ ๊ฐ๋ค์ans
๋ฐฐ์ด์๋ค๊ฐ ์ง์ด๋ฃ์ด์ค๋ค.๊ฒฐ๊ณผ๋ ๋ฌด์ํ ๋ง์ ๊ฐ์ด ์กด์ฌํ ๊ฒฝ์ฐ. ๋ค์ ์ง์ด๋ฃ๊ณ ๊ณ์ฐํ๋ ๊ฒ์ ๊ฒฐ๊ตญ ์๊ฐ ์ด๊ณผ๋ฅผ ์ด๋ํ๋ค.
๋๋ฒ์งธ ํ์ด ๋ฐฉ๋ฒ
positions
์ ์ธ๋ฑ์ค๋ฅผ ํจ๊ป ๋ฌถ์ด์positions
์ ๊ธฐ์ค์ผ๋ก ์ฐ์ ์์ ํ ๋ฐฐ์ด์ ์ ๋ ฌํด์ค๋ค.R์ ์คํ์๋ค๊ฐ ์ง์ด๋ฃ๊ณ L์ ๋ง๋ฌ์ ๊ฒฝ์ฐ์ ์คํ์์ R๋ค์ ์ฐจ๋ก๋๋ก ๊บผ๋ด ๋น๊ตํ๋ค.
๐ ์๋กญ๊ฒ ์๊ฒ๋ ๋ด์ฉ