Skip to content

[김동하-11주차 알고리즘 스터디] #75

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

d11210920
Copy link
Contributor

🚀 싸피 15반 알고리즘 스터디 11주차 [김동하]

📌 문제 풀이 개요

  • 이번 PR에서는 다음 5문제의 풀이를 포함합니다.
  • 각 문제에 대한 풀이 과정과 접근 방식을 설명합니다.

✅ 문제 해결 여부

  • 문제 1
  • 문제 2
  • 문제 3
  • 문제 4
  • 문제 5

💡 풀이 방법

문제 1: 문제 이름

(문제 이름은 현재 문제에 맞게 바꿔주세요! 바꾸시고 이 문장을 지워주세요.)

문제 난이도

문제 유형

접근 방식 및 풀이


문제 2: 문제 이름

문제 유형

접근 방식 및 풀이


문제 3: 문제 이름

문제 유형

접근 방식 및 풀이


문제 4: 문제 이름

문제 유형

접근 방식 및 풀이


문제 5: 문제 이름

문제 유형

접근 방식 및 풀이

Copy link
Contributor

@zinnnn37 zinnnn37 left a comment

Choose a reason for hiding this comment

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

구조화가 잘 되어있어서 재밌게 리뷰했습니다! 갓동하 화이팅👏

Copy link
Contributor

Choose a reason for hiding this comment

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

변수나 함수 이름이 직관적이고 구조가 잘 짜여있어서 좋았습니다! 물고기 냄새가 없는 부분이 5라는 점 같이 코드를 직접 짜지 않은 이상 알기 어려운 부분은 주석을 덧붙여주면 더 좋을 것 같아요!

public static int maxCnt = 0;
public static List<SharkMove> sharkMoves;

public static void findMove(Fish n,int cnt, int idx, List<Integer> dirs) {
Copy link
Contributor

Choose a reason for hiding this comment

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

상좌하우 순으로 탐색을 했으면 사전순으로 확인하게 되는 것이기 때문에 먹은 물고기 개수가 업데이트 되었을 때 경로를 업데이트하는 식으로 구현하면 로직이 더 간단해질 것 같아용

Copy link
Contributor

Choose a reason for hiding this comment

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

이진탐색을 활용한 LIS를 적용하면 시간복잡도를 O(NlogN)으로 줄일 수 있습니다!
이 문제랑 똑같아요: https://www.acmicpc.net/problem/12015

Comment on lines +49 to +58
while(!q.isEmpty()) {
int cur = q.poll();
visited[cur] = true;
for(int next : list[cur]) {
degree[next]--;
if(degree[next] == 0) {
q.add(next);
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

차수가 0인 노드만 큐에 들어가니까 cycle 배열을 관리하는 대신 poll() 할 때마다 값을 카운팅해줘도 될 것 같아요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants