greedy

A collection of 6 post

Stable Setup (Decision Algorithm)

Problem N stables are on a vertical line. Each stable has the coordinates of x1, x2, x3, …, xN, and there is no overlap of coordinates between the stables. Hyeonsu has C horses, who don’t like being close to each other. Each stable can only hold one horse, and we want the horses to be placed in the…

Music Video (Decision Tree Algorithm)

Problem Genie Records is trying to sell the live video of the undisputed singer Youngpil Cho on DVD. A total of N songs are included in a DVD, and when recording on a DVD, the order in live should be maintained. Our singer Youngpil Cho hates the change of order. That is, in order to record songs…

Binary Search

Problem Any N numbers are given as input. Write a program that sorts N numbers in ascending order and, given M, which is one of the N numbers, uses binary search to find the number of M in the sorted state. However, there are no duplicate values. input The first line gives the natural numbers N (…

Meeting Room Assignment

Problem Conference Room There is one conference room, and we want to create a conference room usage table for n conferences that we want to use. Find the maximum number of meetings that are given the time and can use the conference room without overlapping each meeting. However, once a meeting…

Wedding Ceremony

Problem Hyun-soo is getting married next month. Hyun-soo rents a place for the wedding reception and plans to hold it for three days without a break. Hyeon-soo requested information about the time of N friends attending the reception in advance. Each friend told Hyeon-soo what time he would arrive…

Coordinate Alignment

Problem Given N coordinates on a plane (x, y), write a program that sorts all coordinates in ascending order. The sort criterion is first sorted by the x value, and if the x value is the same, it is sorted by the y value. input The first line is given the number of coordinates N (3<=N<=100,00…