| Abakoda Long Contest 2022 |
|---|
| Finished |
Alice, Bob, and Cindy are going caroling! Wouldn't it be cute if they had a special song for each Department of their school? Tonight, they're going to visit the Computer Science Dept. Let's write them a cute song!
The song, "The $$$n$$$ Days of Codemas," has $$$n$$$ verses labeled in order from $$$1$$$ to $$$n$$$, and each verse follows a specific pattern.
You can check the first Sample Output for what the song looks like with $$$n=6$$$ verses, but let's look at how to construct such a song in general. Each verse consists of some number of lines.
For each $$$k$$$ from $$$1$$$ to $$$n$$$, the $$$k$$$th verse looks as follows:
In the first line, <kth> should format the verse number $$$k$$$ in its ordinal form. For this problem, use the following formatting rules:
You have to answer $$$Q$$$ questions of the following form: Given a positive integer $$$i$$$, what is the $$$i$$$th line in the song? Or, say that the song has already ended.
The first line of input contains two space-separated integers $$$n$$$ and $$$Q$$$.
$$$Q$$$ lines follow, each containing some integer $$$i$$$, corresponding to the $$$Q$$$ questions that must be answered.
Contestants are recommended to use fast methods of input and output for this problem. It is recommended that Python users submit to PyPy for this problem.
$$$$$$\begin{align*}
&\begin{array}{|l|} \hline \text{Constraints For All Subtasks} \\ \hline 1 \leq Q \leq 10^5 \\ 1 \leq n \leq 10^9 \\ 1 \leq i \leq 10^{18} \\ \hline \end{array}\\
&\begin{array}{|c|c|l|} \hline \text{Subtask} & \text{Points} & \text{Constraints} \\ \hline
1 & \mathbf{12} & i \leq 15 \\ \hline
2 & \mathbf{40} & i \leq 10^5 \\ \hline
3 & \mathbf{12} & Q \le 5 \\ && i \le 10^{12} \\ \hline
4 & \mathbf{12} & i \le 10^{12} \\ \hline
5 & \mathbf{12} & Q \le 5 \\ \hline
6 & \mathbf{12} & \text{No further constraints.} \\ \hline
\end{array}\\
\end{align*}$$$$$$
Output $$$Q$$$ lines, answering each of the questions in order. If for some question, there is no $$$i$$$th line in the song, then output Codemas is already over! instead.
The checker is strict. Do not even output extra spaces or newlines.
6 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
On the 1st day of Codemas, my computer gave to me, A syntax error on line three! On the 2nd day of Codemas, my computer gave to me, 2 compiler warnings, And a syntax error on line three! On the 3rd day of Codemas, my computer gave to me, 3 compiler warnings, 2 compiler warnings, And a syntax error on line three! On the 4th day of Codemas, my computer gave to me, 4 compiler warnings, 3 compiler warnings, 2 compiler warnings, And a syntax error on line three! On the 5th day of Codemas, my computer gave to me, FIVE! COMPILER! WARNINGS!!! 4 compiler warnings, 3 compiler warnings, 2 compiler warnings, And a syntax error on line three! On the 6th day of Codemas, my computer gave to me, 6 compiler warnings, FIVE! COMPILER! WARNINGS!!! 4 compiler warnings, 3 compiler warnings, 2 compiler warnings, And a syntax error on line three! Codemas is already over! Codemas is already over! Codemas is already over!
2023 8 1 2 561 4000 4004 6216 24753 1000000
On the 1st day of Codemas, my computer gave to me, A syntax error on line three! On the 33rd day of Codemas, my computer gave to me, FIVE! COMPILER! WARNINGS!!! And a syntax error on line three! On the 111th day of Codemas, my computer gave to me, On the 222nd day of Codemas, my computer gave to me, 405 compiler warnings,
| Name |
|---|


