-
Notifications
You must be signed in to change notification settings - Fork 5
HONGJOO/ 5월 4주/ 4개 #215
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
HONGJOO/ 5월 4주/ 4개 #215
Conversation
ttps://school.programmers.co.kr/learn/courses/30/lessons/12914?language=python3
Hongjoo/백준/뿌요뿌요.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분은 queue=deque([[sy, sx])로 줄일 수 있을 것 같아요!
Hongjoo/백준/뿌요뿌요.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 위에서 아래로 내리는 코드가 아래 첨부한 코드처럼 3중 반복문을 도는데, 홍주님 코드처럼 stack을 사용하게 되면 O(N)으로 할 수 있군요!! 감사합니다!!
def down():
for y in range(FIELD_Y):
for x in range(10, -1, -1):
for k in range(FIELD_X - 1, x, -1):
if field[x][y] != '.' and field[k][y] == '.':
field[k][y] = field[x][y]
field[x][y] = '.'
Hongjoo/백준/토마토.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
토마토 문제는 지난 주에 제가 발제했던 문제였는데, 로직을 잘 구현하셨네요!!
정답 풀이는 아래 발제 자료를 참고해주시면 되겠습니당!
바로가기
Hongjoo/백준/장군.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
장군 문제는 8가지의 이동 경로를 어떻게 처리하느냐가 관건이었던 것 같아요! 그만큼 발제자님, 저, 홍주님의 경로 표현 방식이 다 다른 게 인상적이네요
저는 아래와 같이 표현했어요!
# 8가지 이동 경로
directions = [
# 상
((-1, 0), (-1, 1), (-1, 1)), # 오른쪽 위
((-1, 0), (-1, -1), (-1, -1)), # 왼쪽 위
# 하
((1, 0), (1, 1), (1, 1)), # 오른쪽 아래
((1, 0), (1, -1), (1, -1)), # 왼쪽 아래
# 좌
((0, -1), (-1, -1), (-1, -1)), # 왼쪽 위
((0, -1), (1, -1), (1, -1)), # 왼쪽 아래
# 우
((0, 1), (-1, 1), (-1, 1)), # 오른쪽 위
((0, 1), (1, 1), (1, 1)) # 오른쪽 아래
]
🔥2025-05 챌린지 진행 상황👉 그래프
👉 구현
|
🌱WIL
🚀주간 목표 문제 수: 4개
백준 #11559. 뿌요뿌요: 그래프 / 골드4
정리한 링크: (바로가기)
🚩플로우 (선택)
해당 turn에서 전체 field 속 뿌요뿌요가 있는 위치 확인
1-2) BFS로 같은 색상의 뿌요가 4개 이상 연결되있는지 확인하기
-BFS로 연결 개수 확인
-만약, 4개 이상이면 field 에서 비우고(.) , 변환 flag 을 True 변환
1-3) 전체 field 돌고 나서 flag = True (한 번이라도 터지면 )이면
⇒ 전체 field 돌면서 공중에 떠있는 뿌요뿌요 내리기(함수 refine_field)
flag = False 이면 → 종료
🚩제출한 코드
백준 #11559. 장군: 그래프 / 골드4
정리한 링크: (바로가기)
🚩플로우 (선택)
3점 check 하기 (1) 상하좌우 / (2)대각선 1회 / (2)대각선 2회
상 - 우상 , 좌상
하 - 좌하 , 우하
좌 - 좌상, 좌하
우 - 우상, 우하
1st erro
ny2, nx2 = ny1 + dl[dl_combined[i]][0] , nx1 + dl[dl_combined[i]][1]
ny3 , nx3 = ny2 + dl[dl_combined[i]][0] , nx2 + dl[dl_combined[i]][1]
=> i는 0~8 번으로 상 + 우상/좌상 // 하 + 좌하/우하 // 좌 + 좌상,좌하 // 우 + 우상, 우하 순으로 진행
🚩제출한 코드
백준 #11559. 토마토: 그래프 / 골드4
정리한 링크: (바로가기)
🚩플로우 (선택)
🚩제출한 코드
프로그래머스 #12914.멀리뛰기: Backtracking / lv2
정리한 링크: (바로가기)
🚩제출한 코드