Submission #3258514


Source Code Expand

Copy
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int ch[30];
bool used[30];
bool cal(string s,string t){
	memset(ch,-1,sizeof(ch));
	memset(used,false,sizeof(used));
	rep(i,s.size()){
		int x=(s[i]-'a'),y=(t[i]-'a');
		if(ch[x]!=-1 && ch[x]!=y) return false;
		ch[x]=y;used[y]=true;
	}
	/*rep(i,26){
		if(!used[i]) return true;
	}
	rep(i,26){
		if(ch[i]!=i) return false;
	}*/
	return true;
}
int main(){
	string s,t;cin>>s;cin>>t;
	if(cal(s,t) && cal(t,s)) cout<<"Yes"<<endl;else cout<<"No"<<endl;
}

Submission Info

Submission Time
Task C - String Transformation
User sky58
Language C++14 (Clang 3.8.0)
Score 300
Code Size 1187 Byte
Status
Exec Time 21 ms
Memory 1408 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
× 3
× 24
Set Name Test Cases
Sample sample_01, sample_02, sample_03
All 0_min0, 0_min1, 1_small0, 1_small1, 1_small2, 2_medium0, 2_medium1, 2_medium2, 2_medium3, 2_medium4, 3_max0, 3_max1, 3_max2, 3_max3, 3_max4, 3_max5, 3_max6, 3_max7, 3_max8, 3_max9, 5_hand0, sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
0_min0 6 ms 888 KB
0_min1 1 ms 256 KB
1_small0 1 ms 256 KB
1_small1 1 ms 256 KB
1_small2 1 ms 256 KB
2_medium0 16 ms 1024 KB
2_medium1 14 ms 1152 KB
2_medium2 5 ms 512 KB
2_medium3 18 ms 1408 KB
2_medium4 16 ms 896 KB
3_max0 20 ms 1020 KB
3_max1 20 ms 1404 KB
3_max2 20 ms 1404 KB
3_max3 21 ms 1404 KB
3_max4 20 ms 1020 KB
3_max5 20 ms 1020 KB
3_max6 21 ms 1404 KB
3_max7 20 ms 1020 KB
3_max8 20 ms 1020 KB
3_max9 20 ms 1020 KB
5_hand0 1 ms 256 KB
sample_01 1 ms 256 KB
sample_02 1 ms 256 KB
sample_03 1 ms 256 KB