포럼
문제 ICPC00257

H. House Lawn

설명

You have just bought a new house, and it has a huge, beautiful lawn. A lawn that needs cutting. Several times. Every week. The whole summer.

After pushing the lawnmower around the lawn during the hottest Saturday afternoon in history, you decided that there must be a better way. And then you saw the ads for the new robotic lawnmovers. But which one should you buy? They all have different cutting speeds, cutting times and recharge times, not to mention different prices!

According to the advertisement, a robotic lawnmover will

spend all its time either cutting the lawn or recharging its battery. Starting from a full battery, it will cut the lawn at a given rate of \(c\) square meters per minute for a cutting time of \(t\) minutes, after which it has run out of battery. Once out of battery, it will immediately start recharging. After recharging for \(r\) minutes the battery is full again and it immediately starts cutting.

You decide that in order for your lawn to look sufficiently prim and proper, the lawnmower that you buy must be powerful enough to cut your whole lawn at least once a week on average. Formally, if we start the mower fully charged at the beginning of the week and run it for exactly \(T\) weeks, it needs to cut the whole lawn at least \(T\) times, for all positive integers \(T\). But apart from this, you have no specific requirements, so among the ones that satisfy this requirement, you will simply go for the cheapest option. For the purposes of cutting your lawn, you may make the simplifying assumption that a week is always exactly \(10\,080\) minutes long.

제약
입력 형식

The first line of input contains two integers \(\ell\) and \(m\) (\(1 \le \ell \le 10^6\), \(1 \le m \le 100\)), the size of your lawn in square meters, and the number of lawnmowers to consider, respectively.

Then follow \(m\) lines, each containing a string \(n\) and \(4\) integers \(p\), \(c\), \(t\), and \(r\), separated by commas, describing a lawnmower as follows:
- sep0pt
- \(n\) is the name of the lawnmower, a string of at most \(60\) printable characters (ASCII \(32\) to \(126\)) excluding ',', neither starting nor ending with a space,
- \(1 \leq p \leq 100\,000\) is the price of the lawnmover,
- \(1 \leq c \leq 100\) is the cutting rate in square meters per minute,
- \(1 \leq t \leq 10\,080\) is the cutting time in minutes, and
- \(1 \leq r \leq 10\,080\) is the recharge time in minutes.

출력 형식

Output the name of the cheapest lawnmower capable of cutting your whole yard at least once a week on average. If several lawnmovers share the same lowest price, output all of their names, in the same order they were given in the input. If there is no such mower, output "no such mower".

예제 1
입력
7000 4
Grass Slayer 2000,9999,10,120,120
Slow-Mowe,999,1,120,240
Eco-cut X2,5499,2,25,35
Mowepower,5499,3,25,35
출력
Eco-cut X2
Mowepower
예제 2
입력
100000 4
Grass Slayer 2000,9999,10,120,120
Slow-Mowe,999,1,120,240
Eco-cut X2,5499,2,25,35
Mowepower,5499,3,25,35
출력
no such mower
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NCPC 2018

평가 및 의견

H. House Lawn

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

H. House Lawn

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8