목록우선순위 큐 (12)
넘치게 채우기
https://leetcode.com/problems/maximum-number-of-points-from-grid-queries/description/leetcode - Maximum Number of Points From Grid Queries문제 유형: 우선순위 큐, bfs, 그리디문제 난이도: Hard 원래 LeetCode문제를 leetcode solution탭에만 올리고 티스토리에 더 이상 안올리려 했는데..앞으로 인상깊은 문제만 올리려합니다 문제 You are given an m x n integer matrix grid and an array queries of size k.Find an array answer of size k such that for each integer queries[..

https://www.acmicpc.net/problem/28703BOJ - 28703 - Double It문제 유형: 정렬, 우선순위 큐, 슬라이딩 윈도우, 그리디문제 난이도: Gold III시간 제한: 1초메모리 제한: 1024MB 문제양의 정수로 이루어진 길이가 N$N$인 배열 A1,⋯,AN이 주어집니다. 당신은 원하는 만큼 다음 조작을 할 수 있습니다.배열에서 원하는 수 하나를 골라서 2를 곱합니다.조작 이후 A1,⋯,AN의 최댓값과 최솟값의 차이로 가능한 최솟값을 구하세요. 입력첫 줄에 배열의 길이 N이 주어집니다. (1≤N≤200000)둘째 줄에 N개의 양의 정수 A1,A2,⋯,AN이 주어집니다. (1≤Ai≤10^9) 출력조작 이후 A1,⋯,AN의 최댓값과 최솟값의 차이로 가능한 최솟값을 구하..
https://leetcode.com/problems/minimum-operations-to-exceed-threshold-value-ii/description/leetcode - Minimum Operations to Exceed Threshold Value II문제 유형: 우선순위 큐, 힙, 그리디문제 난이도: Medium 문제You are given a 0-indexed integer array nums, and an integer k.In one operation, you will:Take the two smallest integers x and y in nums.Remove x and y from nums.Add min(x, y) * 2 + max(x, y) anywhere in the arra..
https://leetcode.com/problems/design-a-number-container-system/description/leetcode - Design a Number Container System문제 유형: 우선순위 큐, 힙, 해시문제 난이도: Medium 문제Design a number container system that can do the following:Insert or Replace a number at the given index in the system.Return the smallest index for the given number in the system.Implement the NumberContainers class:NumberContainers() Initial..

https://leetcode.com/problems/make-lexicographically-smallest-array-by-swapping-elements/description/leetcode - Make Lexicographically Smallest Array by Swapping Elements문제 유형: 우선순위큐, 유니온-파인드문제 난이도: Medium 문제You are given a 0-indexed array of positive integers nums and a positive integer limit.In one operation, you can choose any two indices i and j and swap nums[i] and nums[j] if |nums[i] - num..
https://www.acmicpc.net/problem/1202BOJ - 보석 도둑문제 유형: 우선순위 큐, 정렬, 그리디, 투포인터문제 난이도: Gold II시간 제한: 1초메모리 제한: 256MB 문제세계적인 도둑 상덕이는 보석점을 털기로 결심했다.상덕이가 털 보석점에는 보석이 총 N개 있다. 각 보석은 무게 Mi와 가격 Vi를 가지고 있다. 상덕이는 가방을 K개 가지고 있고, 각 가방에 담을 수 있는 최대 무게는 Ci이다. 가방에는 최대 한 개의 보석만 넣을 수 있다.상덕이가 훔칠 수 있는 보석의 최대 가격을 구하는 프로그램을 작성하시오. 입력첫째 줄에 N과 K가 주어진다. (1 ≤ N, K ≤ 300,000)다음 N개 줄에는 각 보석의 정보 Mi와 Vi가 주어진다. (0 ≤ Mi, Vi ≤ 1,..
https://leetcode.com/problems/construct-string-with-repeat-limit/description/leetcode - Construct String With Repeat Limit문제 유형: 우선순위 큐, 그리디, 문자열 처리문제 난이도: Medium 문제You are given a string s and an integer repeatLimit. Construct a new string repeatLimitedString using the characters of s such that no letter appears more than repeatLimit times in a row. You do not have to use all characters from s...
https://leetcode.com/problems/maximum-average-pass-ratio/description/leetcode - Maximum Average Pass Ratio문제 유형: 우선순위 큐, 그리디문제 난이도: Medium 문제There is a school that has classes of students and each class will be having a final exam. You are given a 2D integer array classes, where classes[i] = [passi, totali]. You know beforehand that in the ith class, there are totali total students, but only pas..
https://leetcode.com/problems/take-gifts-from-the-richest-pile/description/leetcode - Take Gifts From the Richest Pile문제 유형: 우선순위 큐문제 난이도: Easy 문제You are given an integer array gifts denoting the number of gifts in various piles. Every second, you do the following:Choose the pile with the maximum number of gifts.If there is more than one pile with the maximum number of gifts, choose any.Leave be..
https://www.acmicpc.net/problem/1138BOJ - 줄 세우기문제 유형: 우선순위 큐, 위상 정렬문제 난이도: Silver II시간 제한: 2초메모리 제한: 128MB 문제N명의 사람들은 매일 아침 한 줄로 선다. 이 사람들은 자리를 마음대로 서지 못하고 오민식의 지시대로 선다.어느 날 사람들은 오민식이 사람들이 줄 서는 위치를 기록해 놓는다는 것을 알았다. 그리고 아침에 자기가 기록해 놓은 것과 사람들이 줄을 선 위치가 맞는지 확인한다.사람들은 자기보다 큰 사람이 왼쪽에 몇 명 있었는지만을 기억한다. N명의 사람이 있고, 사람들의 키는 1부터 N까지 모두 다르다.각 사람들이 기억하는 정보가 주어질 때, 줄을 어떻게 서야 하는지 출력하는 프로그램을 작성하시오. 입력첫째 줄에 사람의..