#P4896. OIer们的烦恼

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

OIer们的烦恼

Description

There are 3 handsome teachers AA, BB, and CC.

There are 5 students aa, bb, cc, dd, ee. When any one of them starts playing games, a message XX started playing games! will be shown. When any one of them stops playing games, a message XX stopped playing games! will be shown.

When a teacher comes to patrol the computer room, a message XX came! will be shown. If a teacher leaves, a message XX left! will be shown.

If a teacher finds that some student is playing games, output that student's name.

Input Format

There are NN messages.

The first line contains NN. The second line contains the names of the 3 teachers. The third line contains the names of the 5 students. Then the next NN lines contain the NN messages.

Output Format

Output the names of all students who are found playing games while teachers are patrolling, in lexicographical order.

If all students are found playing games, additionally output How Bad Oiers Are!.

If no one is found, or no one plays games, output How Good Oiers Are!.

10
A B C
a b c d e
A came!
a started playing games!
b started playing games!
A left!
c started playing games!
d started playing games!
e started playing games!
B came!
PS:zhe_ge_yang_li_hen_zheng_chang!
B left!
a b c d e
How Bad Oiers Are!
10
I_Love_You I_Hate_You Why_Not_love_Me
Gay Che_Wan_Dang QwQ WuMaRu PDD
I_Love_You came!
Gay:Why do you love me?
I_Love_You died!
I_Love_You left!
Che_Wan_Dang prepared to play Dong_Fang!
But nobody came!
QwQ:I am so QwQ,I love myself!
PDD started playing Gay!
Gay died!And WuMaRu cried!
WuMaRu:dai su ki!
How Good Oiers Are!
20
Sans QwQ QAQ
A B C D E
A started playing B!
B started fighting with A!
A won!
A get 10000000 Exp!
QwQ:I and QAQ are looking at you all!
C died!
D died!
E recovered 123456789 HP!
E started playing games!
Sans came!
Sans:It is really a nice day today!
Sans:The birds are singing!
Sans:The flowers in bloom!
Sans:In a beautiful day like this!
Sans:People like you!
Sans:Should burn in hell!
E tried to attack Sans!
Sans was killed!
Sans:Papyrus,do you want something?
E still played his Undertale!
E
20
a b c
A B C D E
A came!
a started playing games!
b came!
b came together!
b came! dan_shi_zhe_ju_hua_bu_dui!
A came came came!
b start playing games!
b left!
c came!
c left!
A left!
B started playing games!
A started playing game!
C started palying games!
E started playing games!
lu_ren_jia came!
lu_ren_jia:What are you doing?
C&D:We are studying!
lu_ren_jia:Good boy!
C:qwq
How Good Oiers Are!

Hint

For 20%20\% of the testdata, 1N23.33333333333331\leq N\leq 23.3333333333333.
For 30%30\% of the testdata, 1N999.9991\leq N\leq 999.999, and there is one test point whose answer is How Good Oiers Are!.
For 60%60\% of the testdata, 1N100,0001\leq N\leq 100,000.
For 99.9999999999999999999%99.9999999999999999999\% of the testdata, it is not guaranteed that all messages follow the statement.
For 100%100\% of the testdata, 1N233,3331\leq N\leq 233,333, and the testdata has gradients.

Tips:

  1. There will definitely be some weird stuff in the messages.
  2. A message is valid only if it fully matches the statement.
  3. The sample is disgusting, but the testdata is very innocent.
  4. The testdata guarantees that there will not be multiple teachers patrolling at the same time.
  5. Read the problem and the sample carefully. This problem has traps!

Translated by ChatGPT 5