P8964 Dream | Reopening of Dream
Background
_Hope you have never failed at the last moment because of this._
Flowers bloom not to wither, but to shine more brightly.
At the beginning, you only had ideals and confidence, but everything started to grow and intertwine from here. Keeping on walking along the road paved with effort and sweat is not a wrong choice—at least you have experienced joy, anger, sorrow, and happiness for it.
**May every contestant with ideals achieve ideal results!**
Description
The contestants' code for PION2202 has been published. As someone who has ~~been writing confusing code for ten years in a row~~, of course you want to be the first to spread all kinds of stories from their code.
The first thing to check is whether everyone wrote file input/output correctly. You have asked Xiao E to整理 (zhengli, “organize”) the problem titles and each contestant’s `freopen` statements.
There are $m$ problems in PION2202, and $n$ contestants. You decide to divide contestants into three categories:
1. Normal: the most standard `freopen` statements;
2. Ancestor-seeking: `freopen` statements that are commented out;
3. Fun-seeking: `freopen` statements in other forms.
Formally, for a normal contestant, for every problem, the `freopen` statements must be exactly:
```cpp
freopen(".in","r",stdin);
freopen(".out","w",stdout);
```
where `` should be replaced with the corresponding problem title.
For an ancestor-seeking contestant, among their `freopen` statements there exists at least one line (for at least one problem) that starts with `//freopen(` and ends with `);`.
If a contestant’s `freopen` statements satisfy neither of the above two conditions, then the contestant is called fun-seeking.
You need to determine whether each contestant is normal, ancestor-seeking, or fun-seeking.
Input Format
The first line contains a positive integer $T$, indicating the subtask id.
The second line contains two positive integers $n, m$, indicating the number of contestants and the number of problems.
The next $m$ lines each contain a string consisting only of lowercase letters. The $i$-th of these lines is the title of the $i$-th problem. It is guaranteed that the length of each title is between $1$ and $10$.
The next $n \times (2m + 1)$ lines describe the `freopen` statements. For each block of $2m + 1$ lines: the first line is an empty line; the next $2m$ lines are all `freopen` statements of one contestant for all problems, given in problem order. The first two lines are the `freopen` statements for the first problem, and so on; the last two lines are for the last problem.
It is guaranteed that for every character in every `freopen` statement, its ASCII code is between $33$ and $126$, i.e., it contains no invisible characters such as spaces.
It is guaranteed that the length of each `freopen` statement line is between $1$ and $100$.
Output Format
Output $n$ lines. The $i$-th line indicates the category of the $i$-th contestant.
If the contestant is normal, wish them RP++, so output `PION2202 RP++.`.
If the contestant is ancestor-seeking, output `Wrong file operation takes you to your ancestors along with your 3 years' efforts on OI.`.
If the contestant is fun-seeking, wish them to be careful not to make mistakes while having fun, so output `Good luck and have fun.`.
Explanation/Hint
**[Sample Explanation]**
The first contestant’s `freopen` statements are all standard, so they are normal.
The second contestant commented out the input file statement for problem `woem`, so they are ancestor-seeking. Although this contestant also did fun-seeking behavior in problem `kcarrab`, since they already satisfy the ancestor-seeking condition, they are classified as ancestor-seeking.
The third contestant’s `freopen` statements for all four problems are not standard. The output file statement for `tnalp` is missing a semicolon; `woem` was mistyped as `owem`; `stdin` and `stdout` are swapped in problem `kcarrab`; and the two statements for `hctam` are in reversed order. In this problem, they are considered fun-seeking.
The fourth contestant’s `freopen` statements can work correctly, but since they are different from the standard `freopen` statements, they are considered fun-seeking in this problem.
---
**[Constraints]**
**This problem uses bundled tests.**
Subtask 1 (30 points): $T = 1$. $m = 1$ and the problem title is `yxalag`. However, if you output `No, general!`, you will not get points.
Subtask 2 (30 points): $T = 2$. It is guaranteed that there are no ancestor-seeking contestants.
Subtask 3 (40 points): $T = 3$. No special properties.
For $100\%$ of the data:
- It is guaranteed that $1 \le T \le 3$.
- It is guaranteed that $1 \le n \le 1000$.
- It is guaranteed that $1 \le m \le 4$.
- It is guaranteed that the length of each problem title is between $1$ and $10$.
- It is guaranteed that the length of each `freopen` statement line is between $1$ and $100$.
Translated by ChatGPT 5