#P8964. 梦幻 | Reopening of Dream

    ID: 10031 远端评测题 1000ms 128MiB 尝试: 1 已通过: 0 难度: 3 上传者: 标签>模拟字符串洛谷原创O2优化洛谷月赛

梦幻 | 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!

Problem 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 mm problems in PION2202, and nn 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:

freopen("<title>.in","r",stdin);
freopen("<title>.out","w",stdout);

where <title> 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 TT, indicating the subtask id.

The second line contains two positive integers n,mn, m, indicating the number of contestants and the number of problems.

The next mm lines each contain a string consisting only of lowercase letters. The ii-th of these lines is the title of the ii-th problem. It is guaranteed that the length of each title is between 11 and 1010.

The next n×(2m+1)n \times (2m + 1) lines describe the freopen statements. For each block of 2m+12m + 1 lines: the first line is an empty line; the next 2m2m 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 3333 and 126126, i.e., it contains no invisible characters such as spaces.

It is guaranteed that the length of each freopen statement line is between 11 and 100100.

Output Format

Output nn lines. The ii-th line indicates the category of the ii-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..

3
4 4
tnalp
woem
kcarrab
hctam

freopen("tnalp.in","r",stdin);
freopen("tnalp.out","w",stdout);
freopen("woem.in","r",stdin);
freopen("woem.out","w",stdout);
freopen("kcarrab.in","r",stdin);
freopen("kcarrab.out","w",stdout);
freopen("hctam.in","r",stdin);
freopen("hctam.out","w",stdout);

freopen("tnalp.in","r",stdin);
freopen("tnalp.out","w",stdout);
//freopen("woem.in","r",stdin);
freopen("woem.out","w",stdout);
freopen("kcarrab.in","r",stdin);
//I_AK_IOI!!!
freopen("hctam.in","r",stdin);
freopen("hctam.out","w",stdout);

freopen("tnalp.in","r",stdin);
freopen("tnalp.out","w",stdout)
freopen("owem.in","r",stdin);
freopen("woem.out","w",stdout);
freopen("kcarrab.in","r",stdout);
freopen("kcarrab.out","w",stdin);
freopen("hctam.out","w",stdout);
freopen("hctam.in","r",stdin);

freopen("tnalp.in","r",stdin);//I_LOVE_CCF
freopen("tnalp.out","w",stdout);
freopen("woem.in","r",stdin);//I_HATE_THIS
freopen("woem.out","w",stdout);
freopen("kcarrab.in"/*I_FORGET_HOW_TO_FIND_BRIDGES!!!!!!*/,"r",stdin);
freopen("kcarrab.out","w",stdout);
freopen("hctam.in","r",stdin);//I_CAN_GET_ONLY_8PTSqwq
freopen("hctam.out","w",stdout);

PION2202 RP++.
Wrong file operation takes you to your ancestors along with your 3 years' efforts on OI.
Good luck and have fun.
Good luck and have fun.

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=1T = 1. m=1m = 1 and the problem title is yxalag. However, if you output No, general!, you will not get points.
Subtask 2 (30 points): T=2T = 2. It is guaranteed that there are no ancestor-seeking contestants.
Subtask 3 (40 points): T=3T = 3. No special properties.

For 100%100\% of the data:

  • It is guaranteed that 1T31 \le T \le 3.
  • It is guaranteed that 1n10001 \le n \le 1000.
  • It is guaranteed that 1m41 \le m \le 4.
  • It is guaranteed that the length of each problem title is between 11 and 1010.
  • It is guaranteed that the length of each freopen statement line is between 11 and 100100.

Translated by ChatGPT 5