Skip to content

Commit

Permalink
2024-03-04
Browse files Browse the repository at this point in the history
  • Loading branch information
pknujsp committed Mar 4, 2024
1 parent 54c69c7 commit 1adc4bd
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 22 deletions.
45 changes: 23 additions & 22 deletions pknujsp/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
## โœ๏ธ ๊ธฐ๋ก

| ์ฐจ์‹œ | ๋‚ ์งœ | ๋ฌธ์ œ์œ ํ˜• | ๋งํฌ | ํ’€์ด |
| :----: | :--------: | :-------------: | :-----------------------------------------------------------------------------------------------: | :--------------------------------------------------------: |
| 1์ฐจ์‹œ | 2023.10.07 | BRUTE_FORCE | [BOJ_1107](https://www.acmicpc.net/problem/1107) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/2) |
| 2์ฐจ์‹œ | 2023.10.09 | BRUTE_FORCE | [์—ฐ์† ๋ถ€๋ถ„ ์ˆ˜์—ด ํ•ฉ์˜ ๊ฐœ์ˆ˜](https://school.programmers.co.kr/learn/courses/30/lessons/131701) | [#5](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/5) |
| 3์ฐจ์‹œ | 2023.10.11 | SORT | [์ตœ์†Ÿ๊ฐ’ ๋งŒ๋“ค๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/12941?language=python3) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/8) |
| 4์ฐจ์‹œ | 2023.10.13 | SORT | [ํŠœํ”Œ](https://school.programmers.co.kr/learn/courses/30/lessons/64065) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/9) |
| 5์ฐจ์‹œ | 2023.10.15 | ๊ตฌํ˜„ | [๊ด„ํ˜ธ ๋ณ€ํ™˜](https://school.programmers.co.kr/learn/courses/30/lessons/60058) | [#13](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/13) |
| 6์ฐจ์‹œ | 2023.10.17 | ํƒ์ƒ‰ | [์ฟผ๋“œ์••์ถ• ํ›„ ๊ฐœ์ˆ˜ ์„ธ๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/68936) | [#16](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/16) |
| 7์ฐจ์‹œ | 2023.10.19 | ํƒ์ƒ‰ | [๋ฌด์ธ๋„ ์—ฌํ–‰](https://school.programmers.co.kr/learn/courses/30/lessons/154540) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/20) |
| 8์ฐจ์‹œ | 2023.10.21 | ํƒ์ƒ‰ | [๊ฑฐ๋ฆฌ๋‘๊ธฐ ํ™•์ธํ•˜๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/81302) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/22) |
| 9์ฐจ์‹œ | 2023.10.23 | ๋งต | [์Šคํ‚ฌ ํŠธ๋ฆฌ](https://school.programmers.co.kr/learn/courses/30/lessons/49993) | [#25](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/25) |
| 10์ฐจ์‹œ | 2023.10.25 | ๊ตฌํ˜„ | [์ˆ˜์‹ ์ตœ๋Œ€ํ™”](https://school.programmers.co.kr/learn/courses/30/lessons/67257) | [#28](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/28) |
| 11์ฐจ์‹œ | 2023.10.27 | ๋ฆฌ์ŠคํŠธ | [์˜์–ด ๋๋ง์ž‡๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/12981) | [#30](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/30) |
| 12์ฐจ์‹œ | 2023.10.30 | ํ | [์ด์ค‘์šฐ์„ ์ˆœ์œ„ํ](https://school.programmers.co.kr/learn/courses/30/lessons/42628) | [#36](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/36) |
| 13์ฐจ์‹œ | 2023.11.01 | DP | [๋“ฑ๊ตฃ๊ธธ](https://school.programmers.co.kr/learn/courses/30/lessons/42898) | [#39](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/39) |
| 14์ฐจ์‹œ | 2023.11.03 | ๋งต | [์‹œ์†Œ ์ง๊ฟ](https://school.programmers.co.kr/learn/courses/30/lessons/152996) | [#43](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/43) |
| 15์ฐจ์‹œ | 2023.11.05 | ์ˆ˜ํ•™ | [์˜ˆ์ƒ ๋Œ€์ง„ํ‘œ](https://school.programmers.co.kr/learn/courses/30/lessons/12985) | [#47](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/47) |
| 16์ฐจ์‹œ | 2023.11.08 | ์ˆ˜ํ•™ | [์ˆซ์ž ๋ณ€ํ™˜ํ•˜๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/154538) | [#51](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/51) |
| 17์ฐจ์‹œ | 2023.11.10 | ์Šคํƒ | [์ง์ง€์–ด ์ œ๊ฑฐํ•˜๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/12973) | [#54](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/54) |
| 18์ฐจ์‹œ | 2023.11.13 | ๊ตฌํ˜„ | [ํ‚คํŒจ๋“œ ๋ˆ„๋ฅด๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/67256) | [#60](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/60) |
| 19์ฐจ์‹œ | 2023.11.17 | ๊ตฌํ˜„ | [์‹คํŒจ์œจ](https://school.programmers.co.kr/learn/courses/30/lessons/42889) | [#64](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/64) |
| ์ฐจ์‹œ | ๋‚ ์งœ | ๋ฌธ์ œ์œ ํ˜• | ๋งํฌ | ํ’€์ด |
| :----: | :--------: | :-------------: | :-----------------------------------------------------------------------------------------------: | :---------------------------------------------------------: |
| 1์ฐจ์‹œ | 2023.10.07 | BRUTE_FORCE | [BOJ_1107](https://www.acmicpc.net/problem/1107) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/2) |
| 2์ฐจ์‹œ | 2023.10.09 | BRUTE_FORCE | [์—ฐ์† ๋ถ€๋ถ„ ์ˆ˜์—ด ํ•ฉ์˜ ๊ฐœ์ˆ˜](https://school.programmers.co.kr/learn/courses/30/lessons/131701) | [#5](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/5) |
| 3์ฐจ์‹œ | 2023.10.11 | SORT | [์ตœ์†Ÿ๊ฐ’ ๋งŒ๋“ค๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/12941?language=python3) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/8) |
| 4์ฐจ์‹œ | 2023.10.13 | SORT | [ํŠœํ”Œ](https://school.programmers.co.kr/learn/courses/30/lessons/64065) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/9) |
| 5์ฐจ์‹œ | 2023.10.15 | ๊ตฌํ˜„ | [๊ด„ํ˜ธ ๋ณ€ํ™˜](https://school.programmers.co.kr/learn/courses/30/lessons/60058) | [#13](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/13) |
| 6์ฐจ์‹œ | 2023.10.17 | ํƒ์ƒ‰ | [์ฟผ๋“œ์••์ถ• ํ›„ ๊ฐœ์ˆ˜ ์„ธ๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/68936) | [#16](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/16) |
| 7์ฐจ์‹œ | 2023.10.19 | ํƒ์ƒ‰ | [๋ฌด์ธ๋„ ์—ฌํ–‰](https://school.programmers.co.kr/learn/courses/30/lessons/154540) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/20) |
| 8์ฐจ์‹œ | 2023.10.21 | ํƒ์ƒ‰ | [๊ฑฐ๋ฆฌ๋‘๊ธฐ ํ™•์ธํ•˜๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/81302) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/22) |
| 9์ฐจ์‹œ | 2023.10.23 | ๋งต | [์Šคํ‚ฌ ํŠธ๋ฆฌ](https://school.programmers.co.kr/learn/courses/30/lessons/49993) | [#25](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/25) |
| 10์ฐจ์‹œ | 2023.10.25 | ๊ตฌํ˜„ | [์ˆ˜์‹ ์ตœ๋Œ€ํ™”](https://school.programmers.co.kr/learn/courses/30/lessons/67257) | [#28](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/28) |
| 11์ฐจ์‹œ | 2023.10.27 | ๋ฆฌ์ŠคํŠธ | [์˜์–ด ๋๋ง์ž‡๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/12981) | [#30](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/30) |
| 12์ฐจ์‹œ | 2023.10.30 | ํ | [์ด์ค‘์šฐ์„ ์ˆœ์œ„ํ](https://school.programmers.co.kr/learn/courses/30/lessons/42628) | [#36](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/36) |
| 13์ฐจ์‹œ | 2023.11.01 | DP | [๋“ฑ๊ตฃ๊ธธ](https://school.programmers.co.kr/learn/courses/30/lessons/42898) | [#39](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/39) |
| 14์ฐจ์‹œ | 2023.11.03 | ๋งต | [์‹œ์†Œ ์ง๊ฟ](https://school.programmers.co.kr/learn/courses/30/lessons/152996) | [#43](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/43) |
| 15์ฐจ์‹œ | 2023.11.05 | ์ˆ˜ํ•™ | [์˜ˆ์ƒ ๋Œ€์ง„ํ‘œ](https://school.programmers.co.kr/learn/courses/30/lessons/12985) | [#47](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/47) |
| 16์ฐจ์‹œ | 2023.11.08 | ์ˆ˜ํ•™ | [์ˆซ์ž ๋ณ€ํ™˜ํ•˜๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/154538) | [#51](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/51) |
| 17์ฐจ์‹œ | 2023.11.10 | ์Šคํƒ | [์ง์ง€์–ด ์ œ๊ฑฐํ•˜๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/12973) | [#54](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/54) |
| 18์ฐจ์‹œ | 2023.11.13 | ๊ตฌํ˜„ | [ํ‚คํŒจ๋“œ ๋ˆ„๋ฅด๊ธฐ](https://school.programmers.co.kr/learn/courses/30/lessons/67256) | [#60](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/60) |
| 19์ฐจ์‹œ | 2023.11.17 | ๊ตฌํ˜„ | [์‹คํŒจ์œจ](https://school.programmers.co.kr/learn/courses/30/lessons/42889) | [#64](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/64) |
| 20์ฐจ์‹œ | 2023.11.20 | ๋ฌธ์ž์—ด | [์˜น์•Œ์ด (2)](https://school.programmers.co.kr/learn/courses/30/lessons/133499) | [#70](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/70) |
| 21์ฐจ์‹œ | 2023.11.23 | ๋งต | [์˜์ƒ](https://school.programmers.co.kr/learn/courses/30/lessons/42578) | [#73](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/73) |
| 22์ฐจ์‹œ | 2023.11.26 | ๊ทธ๋ฆฌ๋”” | [๊ตฌ๋ช…๋ณดํŠธ](https://school.programmers.co.kr/learn/courses/30/lessons/42885) | [#79](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/79) |
Expand All @@ -37,4 +37,5 @@
| 33์ฐจ์‹œ | 2024.02.06 | ํ | [์ฒ ๋กœ](https://www.acmicpc.net/problem/13334) | [#132](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/132) |
| 34์ฐจ์‹œ | 2024.02.12 | BFS | [์ด๋ถ„ ๊ทธ๋ž˜ํ”„](https://www.acmicpc.net/problem/1707) | [#135](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/135) |
| 35์ฐจ์‹œ | 2024.02.18 | ๊ทธ๋ฆฌ๋”” | [์„ ๋ฌผํ• ์ธ](https://www.acmicpc.net/problem/25947) | [#137](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/137) |
| 36์ฐจ์‹œ | 2024.02.21 | ์ด์ง„ํƒ์ƒ‰ | [ํœด๊ฒŒ์†Œ ์„ธ์šฐ๊ธฐ](https://www.acmicpc.net/problem/1477) | [#143](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/143) |
| 36์ฐจ์‹œ | 2024.02.21 | ์ด์ง„ํƒ์ƒ‰ | [ํœด๊ฒŒ์†Œ ์„ธ์šฐ๊ธฐ](https://www.acmicpc.net/problem/1477) | [#143](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/143) |
| 37์ฐจ์‹œ | 2024.03.04 | ๊ตฌํ˜„ | [n+1 ์นด๋“œ๊ฒŒ์ž„](https://school.programmers.co.kr/learn/courses/30/lessons/258707) | [#149](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/149) |
53 changes: 53 additions & 0 deletions pknujsp/๊ตฌํ˜„/37-์นด๋“œ๊ฒŒ์ž„.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
def solution(coin, cards):
a = set(cards[:len(cards) // 3])
b = set()
t = len(cards) + 1
r = 1

for i in range(len(cards) // 3 + 1, len(cards), 2):
c1, c2 = cards[i - 1], cards[i]
b.add(c1)
b.add(c2)

removed = False
# ํ˜„์žฌ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ์นด๋“œ ๋ชฉ๋ก ์ค‘ n + 1์ด ๊ฐ€๋Šฅํ•œ ๊ฒฝ์šฐ ํ™•์ธ
for x in list(a):
if t - x in a:
a.remove(t - x)
a.remove(x)
removed = True
break

if removed:
r += 1
continue

# ์ฝ”์ธ์œผ๋กœ ๊ตํ™˜ํ•ด์„œ ์–ป์„ ์ˆ˜ ์žˆ๋Š” ์นด๋“œ ์ค‘์—์„œ n + 1์ด ๋˜๋Š” ๊ฒฝ์šฐ๋ฅผ ์ฐพ์•„์•ผ ํ•จ
# ์ฝ”์ธ์ด ์—†์œผ๋ฏ€๋กœ ์ข…๋ฃŒ
if not coin:
break

# `ํ˜„์žฌ ๊ฐ–๊ณ  ์žˆ๋Š” ์นด๋“œ + ์–ป์„ ์ˆ˜ ์žˆ๋Š” ์นด๋“œ` = n + 1์ด ๋˜๋Š” ๊ฒฝ์šฐ๋ฅผ ํ™•์ธ
for x in list(b):
if t - x in a:
a.remove(t - x)
b.remove(x)
removed = True
coin -= 1
break
# ๋งˆ์ง€๋ง‰ ๋ฐฉ๋ฒ•์œผ๋กœ, ์˜ค์ง ๊ตํ™˜์œผ๋กœ ์–ป์„ ์ˆ˜ ์žˆ๋Š” ์นด๋“œ ๋ชฉ๋ก ์ค‘์—์„œ n + 1์ด ๋˜๋Š” ๊ฒฝ์šฐ๋ฅผ ํ™•์ธ
if not removed and coin >= 2:
for x in list(b):
if t - x in b:
b.remove(t - x)
b.remove(x)
removed = True
coin -= 2
break

# n + 1์„ ์–ด๋–ค ๊ฒฝ์šฐ์—๋„ ๋ชป ๋งŒ๋“ค๋ฉด ์ข…๋ฃŒ
if not removed:
break
r += 1

return r

0 comments on commit 1adc4bd

Please sign in to comment.