No.5017 Tool-assisted Shooting
Story
Platina-kun was playing a certain vertically scrolling shooting game.
In this game, you move your ship at the bottom of the screen left and right to attack the enemy ships that appear at the top of the screen.
After playing this game repeatedly, he came to feel that the positions where enemy ships appear are not completely random but somewhat biased,
and furthermore that the positions where enemy ships are likely to appear change with every play.
Believing that he could earn an even higher score by acting appropriately, he asked you to develop a tool.
Please write a program that controls the ship for him.
Problem Statement
This is a reactive problem.
The game field is represented by a grid with a width of$\ 25\ $cells and a height of$\ 60\ $cells.
The coordinates of the bottom-left cell are $(0,0)$, and the coordinates of the cell reached by moving$\ x\ $cells to the right and$\ y\ $cells up from there are $(x,y)$.
The ship controlled by the player is initially at $(12,0)$ and can only move left and right.
The left and right edges of the field are connected. That is, the cell to the left of the leftmost cell is the rightmost cell, and the cell to the right of the rightmost cell is the leftmost cell.
The following sequence of actions constitutes$\ 1\ $turn, and the game lasts at most$\ 1000\ $turns. There are no enemy ships in the initial state.
- All enemy ships on the field move down by$\ 1\ $cell. Enemy ships that move outside the field disappear.
- New enemy ships appear in the top row. The appearance probability is defined for each column as described later.
- Your ship moves$\ 1\ $cell to the left or right, or stays where it is.
- Your ship automatically attacks the enemy ship closest to it among the enemy ships in the same column as your ship.
Your ship has a level, which is initially$\ 1\ $. Each enemy ship has a durability and a power.
When your ship attacks an enemy ship, the durability of that enemy ship decreases by the value of your ship's level. An enemy ship whose durability has become$\ 0\ $or less is destroyed and disappears.
When an enemy ship is destroyed, the value of its initial durability is added to your score. In addition, your ship's level increases by$\ 1\ $for every$\ 100\ $of total power of the enemy ships destroyed so far.
(That is, if the sum of the powers of the destroyed enemy ships is$\ S\ $, the current level is$\ 1 + \lfloor S/100 \rfloor$.)
Until the game ends, the information on the appearing enemy ships is given every turn, so output your ship's move each time.
Scoring
The score at the end of the game is the score for that test case.
If you output a character not specified for your ship's move, the result is WA.
There are$\ 100\ $test cases in total, and the sum of the scores over all test cases is the score of the submission.
The final ranking is determined by the highest score obtained during the contest, and no system test is performed after the contest ends.
The contest ranking can be checked from the "Score Order" tab above.
Tools (Visualizer, etc.)
A visualizer and sample code are available on GitHub.
When using the visualizer, you can insert comment lines starting with # into your output.
The judge ignores lines starting with #, so your submitted program may output comment lines.
You may share screenshots, videos, etc. of any board state of the visualizer on Twitter and similar services.
We would appreciate it if you use the following hashtags.
#ToolAssistedShooting
#yukicoder
Input
No initial input is given. Every turn, the information on the appearing enemy ships is given from standard input in the following format.
First, the number of appearing enemy ships$\ n\ $is given.
$n$
If $n=-1\ $, the game has ended, so terminate your program immediately.
Otherwise, $n\ $is an integer between$\ 0\ $and$\ 25\ $, inclusive. The information on the enemy ships then follows in the following format.
$h_1\ p_1\ x_1$ $h_2\ p_2\ x_2$ $\vdots$ $h_n\ p_n\ x_n$
The $i\ $-th $(i=1,2,\dots,n)$ enemy ship appears at coordinates $(x_i,59)$, with an initial durability of$\ h_i\ $, and a power of$\ p_i\ $.
The enemy ships in each turn satisfy the following constraints.
- All inputs are integers
- $1 \leq h_i$
- $0 \leq p_i$
- $0 \leq x_1 < x_2 \dots < x_n < 25$
Be sure to receive all of the judge's input through to the end. Otherwise, the result may be
WA.
Output
Every turn, output a character representing your ship's move. The character must be one of the following.
Lto move leftRto move rightSto stay where it is
TLE.After outputting a character representing a move$\ 1000\ $times, terminate your submitted program.
Note that the behavior is undefined if you produce output after the judge returns$\ -1\ $.
Input Generation
Let$\ rand(L,U)\ $denote a function that generates an integer between $L\ $and$\ U\ $, inclusive, uniformly at random.
Let$\ norm(\mu,\sigma^2)\ $denote a function that randomly generates a real value from the normal distribution with mean$\ \mu$, and variance$\ \sigma^2\ $.
- The appearance probability of enemy ships in each column is independently set to$\ P_i=rand(1,8)\ $(not given in the input during the contest).
- Every turn, the appearance of an enemy ship is determined for each column. For $i=0,1,\dots,24\ $, a new enemy ship appears in the$\ i+1\ $-th column from the left with a probability of$\ P_i\ $%.
- For the enemy ships newly appearing on turn $T\ $, the durability$\ h\ $and the power$\ p\ $are determined independently for each ship as follows.
- Let $\mu=7.5+0.15T, \sigma=1.5+0.03T\ $.
- Let $h'=norm(\mu, \sigma^2)\ $, and $h=max(1,\lfloor h' \rfloor)\ $.
- Let $p'=norm(0.8h', (0.1h')^2)\ $, and $p=max(0, \lfloor p' \rfloor)\ $.
When submitting your program, note that $P\ $is not given in the input during the contest.
$P_0\ P_1\ \dots P_{24}$
$n_1$
$h_1\ p_1\ x_1$
$\vdots$
$h_{n_1}\ p_{n_1}\ x_{n_1}$
$\vdots$
$n_{1000}$
$h_1\ p_1\ x_1$
$\vdots$
$h_{n_{1000}}\ p_{n_{1000}}\ x_{n_{1000}}$
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
platinum