0pts求助
查看原帖
0pts求助
677609
Vct14楼主2023/10/18 13:31
#include<bits/stdc++.h>
using namespace std;

string l[100010];
string z[100010];

int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1; i<=n; i++) cin>>l[i];
	for(int i=1; i<=m; i++) cin>>z[i];
	sort(l+1,l+1+n);
	sort(z+1,z+1+m);
	int h=1;
	bool now=true;
	while(1){
		if(h>m){
			if((l[h][0]!=z[h-1][0] || l[h]<=z[h-1]) && l[h][0]!=z[h-1][0]+1) cout<<"Zoe";
			else cout<<"Leona";
			return 0;
		}
		if(h>n){
			cout<<"Zoe";
			return 0;
		} 
		if(now){
			if((z[h][0]!=l[h][0] || z[h]<=l[h]) && z[h][0]!=l[h][0]+1){
				cout<<"Leona";
				return 0;
			}
			h++;
		}
		else{
			if((l[h][0]!=z[h-1][0] || l[h]<=z[h-1]) && l[h][0]!=z[h-1][0]+1){
				cout<<"Zoe";
				return 0;
			}
		}
		now=!now;
	}
	return 0;
}

link

2023/10/18 13:31
加载中...