球hack
查看原帖
球hack
813622
Igallta楼主2025/1/2 15:39
#include<bits/stdc++.h>
#define int long long
using namespace std;
string s,t;
int a1,a2;
char a[11]={'a','t','c','o','d','e','r'};
unordered_map<char,int>mp,pm;
void Fail(){
	cout<<"No";
	exit(0);
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>s>>t;
	for(auto v:s){
		if(v!='@')mp[v]++;
		else a1++;
	}
	for(auto v:t){
		if(v!='@')pm[v]++;
		else a2++;
	}
	for(auto v:mp){
		int k2=pm.count(v.first);
		int k1=v.second;
//		cerr<<v.first<<' '<<k1<<' '<<k2<<'\n'; 
		if(k1!=k2){
			bool is_c=0;
			for(int i=0;i<7;i++){
				if(v.first==a[i]){
					is_c=1;
					break;
				}
			}
			if(!is_c){
				Fail();
			}
			if(k1>k2){
				if(a2<k1-k2){
					Fail();
				}
				a2-=(k1-k2);
				pm[v.first]=k1;
			}else{
				if(a1<k2-k1){
					Fail();
				}
				a1-=(k2-k1);
				mp[v.first]=k2;
			}
		}
	}
	for(auto v:pm){
		int k1=mp.count(v.first);
		int k2=v.second;
//		cerr<<v.first<<' '<<k1<<' '<<k2<<'\n'; 
		if(k1!=k2){
			bool is_c=0;
			for(int i=0;i<7;i++){
				if(v.first==a[i]){
					is_c=1;
					break;
				}
			}
			if(!is_c){
				Fail();
			}
			if(k1>k2){
				if(a2<k1-k2){
					Fail();
				}
				a2-=(k1-k2);
				pm[v.first]=k1;
			}else{
				if(a1<k2-k1){
					Fail();
				}
				a1-=(k2-k1);
				mp[v.first]=k2;
			}
		}
	}
	if(a2!=a1)Fail();
	cout<<"Yes";
	return 0;
}

2025/1/2 15:39
加载中...