목록다시볼문제 (137)
넘치게 채우기
https://leetcode.com/problems/construct-binary-tree-from-preorder-and-postorder-traversal/description/leetcode - Construct Binary Tree from Preorder and Postorder Traversal문제 유형: 트리, 분할 정복문제 난이도: Medium 문제Given two integer arrays, preorder and postorder where preorder is the preorder traversal of a binary tree of distinct values and postorder is the postorder traversal of the same tree, reconstr..
https://codeforces.com/contest/2064/problem/DCodeforces Round 1005(Div. 2) - D. Eating문제 유형: 그리디, 비트마스킹, 이진 탐색시간 제한: 5초메모리 제한: 512MB 문제There are n">n slimes on a line, the i">i-th of which has weight wi">wi. Slime i">i is able to eat another slime j">j if wi≥wj">wi≥wj; afterwards, slime j">j disappears and the weight of slime i">i becomes wi⊕wj">wi⊕wj.The King of Slimes wants to ru..
https://codeforces.com/contest/2067/problem/DCodeforces Round 1004(Div.2)] - D. Obejct Identification문제 유형: 그래프, 생성형, 인터랙티브시간 제한: 2초메모리 제한: 256MB 문제This is an interactive problem.You are given an array x1,…,xn">x1,…,xn of integers from 1">1 to n">n. The jury also has a fixed but hidden array y1,…,yn">y1,…,yn of integers from 1">1 to n">n. The elements of array y">y are unknown to y..
https://www.acmicpc.net/problem/32984BOJ - 겨울이 좋아문제 유형: 이진탐색, 매개변수 탐색문제 난이도: Gold III시간 제한: 1초메모리 제한: 1024MB 문제정우는 겨울을 너무 좋아한다. 하지만 아쉽게도 지금은 가을이다. 정우가 사는 도시에는 N그루의 나무가 있고 A번째 나무에는 A_i개의 나뭇잎이 붙어있다. i번째 나무의 나뭇잎은 하루에 Bi개씩 떨어지며, Bi개보다 적게 남아있을 경우에는 전부 떨어진다. 정우는 N그루의 나무에 있는 모든 나뭇잎이 떨어진 날부터를 겨울이라고 부른다.정우는 특별한 능력을 가지고 있는데, 매일 하나의 나무를 선택해서 그날에 나뭇잎이 2배로 떨어지게 만들 수 있다. 다시 말해서 정우가 i번째 나무를 선택해서 능력을 사용하면 그날 그 ..
https://codeforces.com/contest/2067/problem/CCodeforces Round 1004(Div.2) - C. Devyatkino문제 유형: 수학, 그리디, 탐색, 브루트 포스시간 제한: 2초메모리 제한: 256MB 문제You are given a positive integer n">n. In one operation, you can add to n">n any positive integer whose decimal representation contains only the digit 9">9, possibly repeated several times.What is the minimum number of operations needed to make the number n"..

https://www.acmicpc.net/problem/25279BOJ - Treehouse문제 유형: 기하학, 수학, 해시문제 난이도: Gold III시간 제한: 3초메모리 제한: 1024MB 문제Pusheen wants to build a treehouse in the Treehouse forest in Brunnshög in the north of Lund. The treehouse should to be built on a square platform in the treetops, with a tree in each of the four corners. When Pusheen has picked a spot to built the treehouse, trees that are located be..

https://www.acmicpc.net/problem/6549BOJ - 히스토그램에서 가장 큰 직사각형문제 유형: 히스토그램, 스택(모노토닉 스택), 세그먼트 트리, 분할 정복, 투 포인터문제 난이도: Platinum V시간 제한: 1초메모리 제한: 256MB 문제히스토그램은 직사각형 여러 개가 아래쪽으로 정렬되어 있는 도형이다. 각 직사각형은 같은 너비를 가지고 있지만, 높이는 서로 다를 수도 있다. 예를 들어, 왼쪽 그림은 높이가 2, 1, 4, 5, 1, 3, 3이고 너비가 1인 직사각형으로 이루어진 히스토그램이다.히스토그램에서 가장 넓이가 큰 직사각형을 구하는 프로그램을 작성하시오. 입력입력은 테스트 케이스 여러 개로 이루어져 있다. 각 테스트 케이스는 한 줄로 이루어져 있고, 직사각형의 수 ..

https://www.acmicpc.net/problem/2263BOJ - 트리의 순회문제 유형: 트리, dfs, 분할 정복문제 난이도: Gold I시간 제한: 5초메모리 제한: 128MB 문제n개의 정점을 갖는 이진 트리의 정점에 1부터 n까지의 번호가 중복 없이 매겨져 있다. 이와 같은 이진 트리의 인오더와 포스트오더가 주어졌을 때, 프리오더를 구하는 프로그램을 작성하시오. 입력첫째 줄에 n(1 ≤ n ≤ 100,000)이 주어진다. 다음 줄에는 인오더를 나타내는 n개의 자연수가 주어지고, 그 다음 줄에는 같은 식으로 포스트오더가 주어진다. 출력첫째 줄에 프리오더를 출력한다. 풀이중위순회의 정보는 노드들간의 좌우관계를 알려준다.후위순회에서의 마지막원소는 항상 루트노드의 값이다.즉, 루트노드를 중위순회..
https://leetcode.com/problems/divide-nodes-into-the-maximum-number-of-groups/description/leetcode - Divide Nodes Into the Maximum Number of Groups문제 유형: bfs, 그래프, 연결 컴포넌트, 이분 그래프문제 난이도: Hard 문제You are given a positive integer n representing the number of nodes in an undirected graph. The nodes are labeled from 1 to n.You are also given a 2D integer array edges, where edges[i] = [ai, bi] indicate..
https://www.acmicpc.net/problem/1562BOJ - 계단 수문제 유형: 다이나믹 프로그래밍, 비트마스킹문제 난이도: Gold I시간 제한: 2초메모리 제한: 128MB 문제45656이란 수를 보자.이 수는 인접한 모든 자리의 차이가 1이다. 이런 수를 계단 수라고 한다.N이 주어질 때, 길이가 N이면서 0부터 9까지 숫자가 모두 등장하는 계단 수가 총 몇 개 있는지 구하는 프로그램을 작성하시오. 0으로 시작하는 수는 계단수가 아니다. 입력첫째 줄에 N이 주어진다. N은 1보다 크거나 같고, 100보다 작거나 같은 자연수이다. 출력첫째 줄에 정답을 1,000,000,000으로 나눈 나머지를 출력한다. 풀이0~9이므로, 등장여부 상태를 비트마스킹을 이용할 수 있다. (처음에 상태추적을..