#P1580. yyy loves Easter_Egg I

yyy loves Easter_Egg I

Description

yyy loves OI (Huntfire), yyy loves Maths (redbag), and yyy loves Chemistry (absi2011) take turns bombing yyy loves Physics (soha), in the order Huntfire, redbag, absi2011.

In this problem, we do not consider complicated queue shapes. We consider the queue shape to be maintained if and only if a line contains exactly one @, and the person being @-mentioned is the same as in the previous line.

For example, the following are also considered to maintain the queue shape:

  • yyy loves OI : @yyy loves Microelectronic
  • yyy loves Maths : @yyy loves Microelectronic 我佩服soha的出题效率
  • yyy loves OI : @yyy loves Microelectronic +1
  • yyy loves Chemistry : +1 @yyy loves Microelectronic

If the person being @-mentioned is different from the one in the first line, the queue shape is considered broken. If the bombed person appears to speak before the queue shape is broken, or they are the one who breaks the queue shape, the frying is considered successful.

If the frying is successful, output Successful @someone attempt. If the queue shape is broken first, output Unsuccessful @someone attempt, then output the line number where the queue shape is first broken, and the id\text{id} of the person who first broke the queue shape.

If the queue shape is never broken, first output Unsuccessful @someone attempt, then output the length of the queue shape, and finally output Good Queue Shape.

p.s.yyy loves Microelectronic 是 kkksc03

Input Format

NN lines of message logs after the bombing starts, one message per line. Message format: “sender + : + content”. Each line’s length does not exceed 10001000. (Chinese is replaced by pinyin.)

Output Format

If the frying is successful, output Successful @someone attempt.

If the queue shape is broken first, output three lines:

  • First line: Unsuccessful @someone attempt.
  • Second line: the line number where the queue shape is first broken.
  • Third line: the id\text{id} of the person who first broke the queue shape.

If the queue shape is never broken, output three lines:

  • First line: Unsuccessful @someone attempt.
  • Second line: the length of the queue shape.
  • Third line: Good Queue Shape.
yyy loves OI : @yyy loves Physics wo pei fu ni de chu ti xiao lv
yyy loves Maths : @yyy loves Physics wo pei fu ni de chu ti xiao lv
yyy loves Chemistry : @yyy loves Physics wo pei fu ni de chu ti xiao lv
yyy loves Microelectronic : ni men wu liao me 
yyy loves OI : @yyy loves Physics wo pei fu ni de chu ti xiao lv


Unsuccessful @yyy loves Physics attempt
4
yyy loves Microelectronic

yyy loves OI : @yyy loves Physics wo pei fu ni de chu ti xiao lv
yyy loves Maths : @yyy loves Physics wo pei fu ni de chu ti xiao lv
yyy loves Chemistry : @yyy loves Physics wo pei fu ni de chu ti xiao lv
yyy loves OI : @yyy loves Physics wo pei fu ni de chu ti xiao lv
yyy loves Maths : @yyy loves Physics wo pei fu ni de chu ti xiao lv
yyy loves Chemistry : @yyy loves Physics wo pei fu ni de chu ti xiao lv
yyy loves OI : @yyy loves Physics wo pei fu ni de chu ti xiao lv
yyy loves Maths : @yyy loves Physics wo pei fu ni de chu ti xiao lv
yyy loves Chemistry : @yyy loves Physics wo pei fu ni de chu ti xiao lv
yyy loves Physics : ni men gou le 


Successful @yyy loves Physics attempt

Hint

@yyy loves Physics 我佩服你的出题效率

This problem merely pokes fun at soha and commemorates the author’s queue shape, which lasted 9191 lines.

For 100%100\% of the testdata, each line length 103\le 10^3.

  • The number of lines does not exceed 5×1045\times 10^4.
  • The input file size does not exceed 4MB4\text{MB}.
  • The first speaker is guaranteed to @ someone.
  • Everyone’s name is guaranteed to follow the format yyy loves ***\text{yyy loves ***}.
  • It is guaranteed that nobody’s message contains :.
  • The first speaker is guaranteed to @ exactly one person.
  • The first speaker is guaranteed not to @ themselves.
  • There is guaranteed to be an empty line at the end of the file to help you detect EOF.
  • It is not guaranteed how many people later speakers will @; however, if the number is not exactly one, it is considered breaking the queue shape.
  • It is not guaranteed whether later speakers will repeatedly @ the same person.
  • It is not guaranteed that the bombed person will break the queue shape.
  • It is not guaranteed whether this problem is or is not the final problem.
  • It is not guaranteed that this contest set even has a final problem.
  • It is not guaranteed that the next contest set will be as easy as this one.
  • It is not guaranteed that there are no others in the group besides these 44 people and kkksc03.
  • It is not guaranteed that mocking soha without ACing this problem won’t cause trouble.
  • If you AC it, you may mock soha once; soha won’t mind.

Translated by ChatGPT 5