Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

14-H0ngJu #183

Merged
merged 3 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions H0ngJu/DFS/μΉ˜ν‚¨ 배달.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import sys
from itertools import combinations

def input(): return sys.stdin.readline().rstrip()

N, M = map(int, input().split())
house = [[] for _ in range(N)]
chicken_house = []
chicken_dis = [[9999 for _ in range(N)] for _ in range(N)]
result = 99999

for i in range(N):
house[i].extend(map(int, input().split()))

for r in range(N):
for c in range(N):
if house[r][c] == 2:
chicken_house.append((r, c))

for chickens in combinations(chicken_house, M):
total = 0
for r in range(N):
for c in range(N):
if house[r][c] == 1:
tmp = 9999
for chicken in chickens:
tmp = min(tmp, abs(r - chicken[0]) + abs(c - chicken[1]))
total += tmp

result = min(result, total)
Comment on lines +20 to +30
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

와 μ§„μ§œ combinations μ•ˆλ– μ˜¬λΌκ°€μ§€κ³  λ°±νŠΈλž˜ν‚ΉμœΌλ‘œ κ΅¬ν˜„ν•˜κ³  μžˆμ—ˆλŠ”λ°..

μ‹œκ°„μ΄ˆκ³Όλ‚˜μ„œ ν™”λ”±μ§€λ‚˜μ„œ PRλ΄€λŠ”λ° μ§„μ§œ ν—ˆλ¬΄ν•˜λ„€μš”.................

μ§„μ§œ 감 λ‹€μ£½μ—ˆλ”°........... γ… γ… γ… γ… γ… γ… γ… γ… γ… γ… γ… γ… γ… γ… γ… γ… γ… γ… γ… γ… 

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저어도 combinations μ•Œκ²Œλ˜κΈ° μ „κΉŒμ§€ λ§Žμ€ μ‚½μ§ˆμ΄ μžˆμ—ˆλ‹€μ£  .. γ…‹..γ…‹.γ…‹..


print(result)
1 change: 1 addition & 0 deletions H0ngJu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
| 11μ°¨μ‹œ | 2024.04.07 | κ΅¬ν˜„ | [사탕 κ²Œμž„](https://www.acmicpc.net/problem/9095) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/178 |
| 12μ°¨μ‹œ | 2024.04.09 | DFS | [ABCDE](https://www.acmicpc.net/problem/13023) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/180 |
| 13μ°¨μ‹œ | 2024.05.06 | 완전탐색 | [리λͺ¨μ»¨](https://www.acmicpc.net/problem/1107) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/181 |
| 14μ°¨μ‹œ | 2024.05.09 | DFS | [μΉ˜ν‚¨λ°°λ‹¬](https://www.acmicpc.net/problem/15686) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/183 |

---