Skip to content

Conversation

@oncsr
Copy link
Contributor

@oncsr oncsr commented Feb 25, 2025

🧷 문제 링크

https://www.acmicpc.net/problem/2104

🧭 풀이 시간

30분

👀 체감 난이도

✏️ 문제 설명

  • 길이 N인 정수 배열 A이 주어지면 $1 \le i \le j \le N$를 만족하는 적당한 $i, j$를 골라 $(A_i + \cdots + A_j) \times \min(A_i, \cdots, A_j)$를 최대로 만들어보자.

🔍 풀이 방법

[사용한 알고리즘]

  • 정렬
  • 분리 집합

  • 가장 큰 원소부터 차례대로 탐색한다고 가정하면, $i$번째에 탐색되는 원소의 양 옆으로 이전에 탐색되었던 최대 길이를 구해서 정답을 갱신할 수 있다.
  • 원소들끼리의 탐색 여부에 대한 연결 관계를 위해 분리 집합을 사용한다.

⏳ 회고

똑같은 문제들이 굉장히 많다
https://www.acmicpc.net/problem/1725
https://www.acmicpc.net/problem/1989
https://www.acmicpc.net/problem/6549
https://www.acmicpc.net/problem/11861
]https://www.acmicpc.net/problem/12846
https://www.acmicpc.net/problem/14727

@oncsr oncsr self-assigned this Feb 25, 2025
@oncsr oncsr added the success 👍 해설을 보지 않고 풀었을 때 label Feb 25, 2025
@ShinHeeEul ShinHeeEul merged commit a8ed4eb into main Feb 25, 2025
1 check passed
Copy link
Contributor

@ShinHeeEul ShinHeeEul left a comment

Choose a reason for hiding this comment

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

좋은 풀이 공유 감사합니다 :)

Comment on lines +29 to +32
Copy link
Contributor

Choose a reason for hiding this comment

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

관점 분리 LGTM :)

Comment on lines +65 to +76
Copy link
Contributor

@ShinHeeEul ShinHeeEul Feb 26, 2025

Choose a reason for hiding this comment

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

오 잘 이해는 못했지만, 이런 식으로도 풀 수 있군요 ㄷㄷ

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

Labels

success 👍 해설을 보지 않고 풀었을 때

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants