목록전체 글 (1209)
넘치게 채우기
https://www.acmicpc.net/problem/17070BOJ - 파이프 옮기기 1문제 유형: dfs/bfs, 다이나믹 프로그래밍문제 난이도: Gold V시간 제한메모리 제한 문제유현이가 새 집으로 이사했다. 새 집의 크기는 N×N의 격자판으로 나타낼 수 있고, 1×1크기의 정사각형 칸으로 나누어져 있다. 각각의 칸은 (r, c)로 나타낼 수 있다. 여기서 r은 행의 번호, c는 열의 번호이고, 행과 열의 번호는 1부터 시작한다. 각각의 칸은 빈 칸이거나 벽이다.오늘은 집 수리를 위해서 파이프 하나를 옮기려고 한다. 파이프는 아래와 같은 형태이고, 2개의 연속된 칸을 차지하는 크기이다.파이프는 회전시킬 수 있으며, 아래와 같이 3가지 방향이 가능하다.파이프는 매우 무겁기 때문에, 유현이는 파이..
https://leetcode.com/problems/delete-characters-to-make-fancy-string/description/?envType=daily-question&envId=2024-11-01leetcode - Delete Characters to Make Fancy String문제 유형: 문자열 처리문제 난이도: Easy 문제A fancy string is a string where no three consecutive characters are equal.Given a string s, delete the minimum possible number of characters from s to make it fancy.Return the final string after the ..
https://leetcode.com/problems/minimum-total-distance-traveled/description/?envType=daily-question&envId=2024-10-31leetcode - Minimum Total Distance Traveled문제 유형: 다이나믹 프로그래밍, 슬라이딩 윈도우문제 난이도: Hard 문제There are some robots and factories on the X-axis. You are given an integer array robot where robot[i] is the position of the ith robot. You are also given a 2D integer array factory where factory[j] ..
https://www.acmicpc.net/problem/1991BOJ - 트리 순회문제 유형: DFS, 트리, 재귀문제 난이도: Silver I시간 제한: 2초메모리 제한: 128MB 문제이진 트리를 입력받아 전위 순회(preorder traversal), 중위 순회(inorder traversal), 후위 순회(postorder traversal)한 결과를 출력하는 프로그램을 작성하시오.예를 들어 위와 같은 이진 트리가 입력되면,전위 순회한 결과 : ABDCEFG // (루트) (왼쪽 자식) (오른쪽 자식)중위 순회한 결과 : DBAECFG // (왼쪽 자식) (루트) (오른쪽 자식)후위 순회한 결과 : DBEGFCA // (왼쪽 자식) (오른쪽 자식) (루트) 입력첫째 줄에는 이진 트리의 노드의 개..
https://www.acmicpc.net/problem/1932BOJ - 정수 삼각형문제 유형: 다이나믹 프로그래밍문제 난이도: Silver I시간 제한: 2초메모리 제한: 128MB 문제 7 3 8 8 1 0 2 7 4 44 5 2 6 5위 그림은 크기가 5인 정수 삼각형의 한 모습이다.맨 위층 7부터 시작해서 아래에 있는 수 중 하나를 선택하여 아래층으로 내려올 때, 이제까지 선택된 수의 합이 최대가 되는 경로를 구하는 프로그램을 작성하라. 아래층에 있는 수는 현재 층에서 선택된 수의 대각선 왼쪽 또는 대각선 오른쪽에 있는 것 중에서만 선택할 수 있다.삼각형의 크기는 1 이상 500 이하이다. 삼각형을 이루고 있는 각 수는 모두 정수이..
https://leetcode.com/problems/minimum-number-of-removals-to-make-mountain-array/description/?envType=daily-question&envId=2024-10-30leetcode - Minimum Number of Removals to Make Mountain Array문제 유형: LIS(Longest Increasing Subsequence), 다이나믹 프로그래밍문제 난이도: Hard 문제You may recall that an array arr is a mountain array if and only if:arr.length >= 3There exists some index i (0-indexed) with 0 such tha..
https://codeforces.com/contest/2033/problem/DCodeforces Round 981(Div.3) - D. Kosuke's Assignment문제 유형: 부분합, 그리디, 다이나믹 프로그래밍시간 제한: 2초메모리 제한: 256MB 문제After a trip with Sakurako, Kousuke was very scared because he forgot about his programming assignment.In this assignment, the teacher gave him an array a">a of n">n integers and asked him to calculate the number of non-overlapping segments of the a..
https://www.acmicpc.net/problem/1916BOJ - 최소비용 구하기문제 유형: 최단 거리, 그래프이론문제 난이도: Gold V시간 제한: 0.5초메모리 제한: 128MB 문제N개의 도시가 있다. 그리고 한 도시에서 출발하여 다른 도시에 도착하는 M개의 버스가 있다. 우리는 A번째 도시에서 B번째 도시까지 가는데 드는 버스 비용을 최소화 시키려고 한다. A번째 도시에서 B번째 도시까지 가는데 드는 최소비용을 출력하여라. 도시의 번호는 1부터 N까지이다. 입력첫째 줄에 도시의 개수 N(1 ≤ N ≤ 1,000)이 주어지고 둘째 줄에는 버스의 개수 M(1 ≤ M ≤ 100,000)이 주어진다. 그리고 셋째 줄부터 M+2줄까지 다음과 같은 버스의 정보가 주어진다. 먼저 처음에는 그 버스의..
https://leetcode.com/problems/maximum-number-of-moves-in-a-grid/?envType=daily-question&envId=2024-10-29leetcode - Maximum Number of Moves in a Grid문제 유형: 다이나믹 프로그래밍, 재귀, dfs, 행렬문제 난이도: Medium 문제You are given a 0-indexed m x n matrix grid consisting of positive integers.You can start at any cell in the first column of the matrix, and traverse the grid in the following way:From a cell (row, col),..
https://codeforces.com/contest/2033/problem/CCodeforces Round 981(Div.3) - C. Sakurako's Field Trip문제 유형: 투 포인터, 그리디시간 제한: 2초메모리 제한: 256MB 문제Even in university, students need to relax. That is why Sakurakos teacher decided to go on a field trip. It is known that all of the students will be walking in one line. The student with index i">i has some topic of interest which is described as ai">a_i.A..