목록그리디 (88)
넘치게 채우기
https://codeforces.com/contest/2055/problem/ACodeforces Round 996(Div.2) - A. Two Frogs문제 유형: 구현, 수학, 그리디시간 제한: 1초메모리 제한: 256MB 문제There are n">n lilypads arranged in a row, numbered from 1">1 to n">n from left to right. Alice and Bob are frogs initially positioned on distinct lilypads, a">a and b">b, respectively. They take turns jumping, starting with Alice.During a frog's turn, it can jump eit..
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/minimum-length-of-string-after-operations/description/leetcode - Minimum Length of String After Operations문제 유형: 문자열 처리, 그리디문제 난이도: Medium 문제You are given a string s.You can perform the following process on s any number of times:Choose an index i in the string such that there is at least one character to the left of index i that is equal to s[i], and at least one ch..
https://leetcode.com/problems/minimum-number-of-operations-to-move-all-balls-to-each-box/description/leetcode - Minimum Number of Operations to Move All Balls to Each Box문제 유형: 그리디, 구간합, 라인 스위핑문제 난이도: Medium 문제You have n boxes. You are given a binary string boxes of length n, where boxes[i] is '0' if the ith box is empty, and '1' if it contains one ball.In one operation, you can move one ball fr..
https://codeforces.com/contest/2043/problem/DEducational Codeforces Round 173(Div.2) - D. Problem about GCD문제 유형: 수학, 브루트 포스, 그리디시간 제한: 1초메모리 제한: 256MB 문제Given three integers l">l, r">r, and G">G, find two integers A">A and B">B (l≤A≤B≤r">l≤A≤B≤r) such that their greatest common divisor (GCD) equals G">G and the distance |A−B|">|A−B| is maximized.If there are multiple..
https://codeforces.com/contest/2043/problem/CEducational Codeforces Round 173(Div.2) - C. Sums on Segments문제 유형: 수학, 부분합, 그리디시간 제한: 1초메모리 제한: 256MB 문제You are given an array a">a of n">n integers, where all elements except for at most one are equal to −1">−1 or 1">1. The remaining element x">x satisfies −109≤x≤109">−10^9≤x≤10^9.Find all possible sums of subarrays of a"..
https://leetcode.com/problems/best-sightseeing-pair/description/leetcode - Best Sightseeing Pair문제 유형: 그리디, 다이나믹 프로그래밍문제 난이도: Medium 문제You are given an integer array values where values[i] represents the value of the ith sightseeing spot. Two sightseeing spots i and j have a distance j - i between them.The score of a pair (i values[i] + values[j] + i - j: the sum of the values of the sightseein..
https://leetcode.com/problems/max-chunks-to-make-sorted/description/leetcode - Max Chunks To Make Sorted문제 유형: 그리디, 브루트 포스문제 난이도: Medium 문제You are given an integer array arr of length n that represents a permutation of the integers in the range [0, n - 1].We split arr into some number of chunks (i.e., partitions), and individually sort each chunk. After concatenating them, the result should equa..
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/final-array-state-after-k-multiplication-operations-i/description/leetcode - Final Array State After K Multiplication Operations I문제 유형: 구현, 그리디문제 난이도: Easy 문제You are given an integer array nums, an integer k, and an integer multiplier.You need to perform k operations on nums. In each operation:Find the minimum value x in nums. If there are multiple occurrences of t..