P1071 潜伏者

Miku

恶心的小模拟

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
string a,b,c;
map <char,char> co1;
map<char,char > co2;
map<char,int> vis,v2;
int l;
int main(){
	cin>>a>>b>>c;
	l=a.length();
	for(int i=0;i<l;++i){
		if(!vis[b[i]]){
//			vis[b[i]]=1;
			if(v2[a[i]]!=0){
				if(co1[a[i]]==b[i]){
					continue;
				}else
				cout<<"Failed";
				return 0;
			}
			v2[a[i]]=vis[b[i]]=1;
			co1[a[i]]=b[i];
			co2[b[i]]=a[i];	
		}else{
			if(co1[a[i]]==b[i]){
				continue;
			}else{
				cout<<"Failed";
				return 0;
			}
		}
	}
	for(char i='A';i<='Z';++i){
		if(!vis[i]){
			cout<<"Failed";
			return 0;
		}
	}
	l=c.length();
	for(int i=0;i<l;++i){
		cout<<co1[c[i]];
	}
	return 0;
} 
posted @ 2020-10-05 21:56  Simex  阅读(97)  评论(0编辑  收藏  举报