80分WA#3WA#5求助
查看原帖
80分WA#3WA#5求助
1344756
ROU_bing楼主2024/12/28 21:39

民间的hack我也都过了,别人都是WA#7WA#8的,对我也没有参考价值,球球dalao调一下吧QAQ

#include <iostream>
#include <cstring>
#include <map>

using namespace std;

int n,num;
string who,temp,studentName[6];
map <string,bool> teacher,student,looking,playing,lucklydog;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for (int i=1;i<=3;i++){	cin>>who;	teacher[who]=1;}
	for (int i=1;i<=5;i++){	cin>>who;	studentName[i]=who,student[who]=1;}
	getline(cin,temp);
	while (n--){
		cin>>who;
		getline(cin,temp);
		if (teacher[who]){
			if (temp==" came!" && looking[who]==0)	num++,looking[who]=1;
			if (temp==" left!" && looking[who]==1)	num--,looking[who]=0;
		}else if(student[who]){
			if (temp==" started playing games!")	playing[who]=1;
			if (temp==" stopped playing games!")	playing[who]=0;
		}else{
			temp="\0";
			continue;
		}
		if (num>0){
			for (int i=1;i<=5;i++)
				if (playing[studentName[i]])
					lucklydog[studentName[i]]=1;
		}
	}
	num=0;
	for (int i=1;i<=5;i++)
		if (lucklydog[studentName[i]]){
			cout<<studentName[i]<<' ';
			num++;
		}
	if (!num)	cout<<"\nHow Good Oiers Are!";	
	if (num==5)	cout<<"\nHow Bad Oiers Are!";	
	return 0;
}
2024/12/28 21:39
加载中...