Submission #3253762


Source Code Expand

Copy
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>

using namespace std;

string s, t;
unordered_map<char, char> m1, m2;

int main()
{
	cin >> s >> t;

	int n = s.length();
	for (int i = 0; i < n; ++i) {
		if (m1.count(s[i]) && m1[s[i]] != t[i]) {
			cout << "No" << endl;
			return 0;
		}

		if (m2.count(t[i]) && m2[t[i]] != s[i]) {
			cout << "No" << endl;
			return 0;
		}
		
		m1[s[i]] = t[i];
		m2[t[i]] = s[i];
	}

	cout << "Yes" << endl;

	return 0;
}

Submission Info

Submission Time
Task C - String Transformation
User suzyz
Language C++14 (GCC 5.4.1)
Score 300
Code Size 574 Byte
Status
Exec Time 38 ms
Memory 776 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 1 ms 256 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 11 ms 772 KB
2_medium1 26 ms 772 KB
2_medium2 7 ms 384 KB
2_medium3 27 ms 776 KB
2_medium4 13 ms 772 KB
3_max0 14 ms 776 KB
3_max1 38 ms 776 KB
3_max2 14 ms 776 KB
3_max3 26 ms 776 KB
3_max4 16 ms 776 KB
3_max5 14 ms 776 KB
3_max6 31 ms 776 KB
3_max7 25 ms 776 KB
3_max8 24 ms 776 KB
3_max9 31 ms 776 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