#P1095. [NOIP 2007 普及组] 守望者的逃离

[NOIP 2007 普及组] 守望者的逃离

Description

The ambitious demon hunter Youdian (pinyin) betrayed the Night Elves and led the Naga hidden in the depths of the sea in an attempted rebellion.

In a confrontation with Youdian, the Warden fell into an ambush and was trapped on a desolate island.

To kill the Warden, Youdian cast a spell on the island, which would soon sink. By then, everyone on the island would perish.

The Warden’s running speed is 17m/s17\text{m/s}, which is not enough to escape the island. Fortunately, the Warden has the “Blink” spell, which moves 60m60\text{m} in 1s1\text{s}, but each use consumes 1010 mana points. The Warden’s mana regenerates at 44 points per second, and only while standing still to rest.

You are given the Warden’s initial mana MM, the distance SS from the starting position to the island’s exit, and the time TT before the island sinks. Your task is to write a program to help the Warden compute how to escape the island in the shortest time. If escape is impossible, output the farthest distance the Warden can travel within the remaining time.

Note: Running, blinking, and resting are measured in seconds, and each action lasts an integer number of seconds. Distances are measured in meters.

Input Format

A single line containing three non-negative integers, denoting MM, SS, TT.

Output Format

Output two lines.

The first line contains a string Yes\texttt{Yes} or No\texttt{No}, indicating whether the Warden can escape the island.

The second line contains an integer. If the first line is Yes\texttt{Yes}, it represents the minimum time for the Warden to escape. If the first line is No\texttt{No}, it represents the farthest distance the Warden can travel.

39 200 4

No
197

36 255 10
Yes
6

Hint

For 30%30\% of the testdata, 1T101 \le T \le 10, 1S1001 \le S \le 100.

For 50%50\% of the testdata, 1T1031 \le T \le 10^3, 1S1041 \le S \le 10^4.

For 100%100\% of the testdata, 1T3×1051 \le T \le 3\times 10^5, 0M1030 \le M \le 10^3, 1S1081 \le S \le 10^8.

Translated by ChatGPT 5