题目链接:传送门
做完才感觉浪费时间呦…
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <algorithm>
#include <climits>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define
#define
using namespace std;
typedef long long ll;
string stu[6], tea[4];
int n, cnt, hasdo[6], here[4], nowdo[6];
int main(int argc, char const *argv[]) {
cin >> n;
for (int i = 1; i <= 3; i++) cin >> tea[i];
for (int i = 1; i <= 5; i++) cin >> stu[i];
sort(stu + 1, stu + 6);
while (n--) {
string s, type, name; cin >> name; getline(cin, s);
int whichtea = 0, whichstu = 0;
for (int j = 1; j <= 3; j++) if (name == tea[j]) {whichtea = j; break;}
for (int j = 1; j <= 5; j++) if (name == stu[j]) {whichstu = j; break;}
if (s == " came!" and whichtea) {
here[whichtea] = true;
for (int j = 1; j <= 5; j++) if (nowdo[j]) hasdo[j] = true;
}
if (s == " left!" and whichtea) here[whichtea] = false;
if (s == " started playing games!" and whichstu) {
int istea = 0; nowdo[whichstu] = 1;
for (int j = 1; j <= 3; j++) if (here[j]) {istea = true; break;}
if (istea) hasdo[whichstu] = 1;
}
if (s == " stopped playing games!" and whichstu) nowdo[whichstu] = false;
}
for (int i = 1; i <= 5; i++) {
if (!hasdo[i]) continue; cnt++;
if (i == 5) cout << stu[i];
else cout << stu[i] << " ";
}
if (cnt == 5) puts("\nHow Bad Oiers Are!");
if (!cnt) puts("How Good Oiers Are!");
}