Submission #3256959


Source Code Expand

#include <iostream>
#include <string>
#include <map>
using namespace std;

int main(int argc, const char * argv[]) {
    string S, T; cin >> S >> T;
    map<char, char> mp1;
    map<char, char> mp2;
    
    for (int i = 0; i < (int) S.length(); i++) {
        if(mp1.count(S[i]) == 0) {
            mp1[S[i]] = T[i];
        } else if (mp1[S[i]] != T[i]) {
            cout << "No" << endl;
            exit(0);
        }
    }
    
    for (int i = 0; i < (int) S.length(); i++) {
        if(mp2.count(T[i]) == 0) {
            mp2[T[i]] = S[i];
        } else if (mp2[T[i]] != S[i]) {
            cout << "No" << endl;
            exit(0);
        }
    }
    
    cout << "Yes" << endl;

    return 0;
}

Submission Info

Submission Time
Task C - String Transformation
User Shiro_K
Language C++14 (Clang 3.8.0)
Score 300
Code Size 740 Byte
Status AC
Exec Time 28 ms
Memory 1020 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 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 AC 6 ms 888 KiB
0_min1 AC 1 ms 256 KiB
1_small0 AC 1 ms 256 KiB
1_small1 AC 1 ms 256 KiB
1_small2 AC 1 ms 256 KiB
2_medium0 AC 15 ms 704 KiB
2_medium1 AC 23 ms 704 KiB
2_medium2 AC 6 ms 384 KiB
2_medium3 AC 24 ms 768 KiB
2_medium4 AC 15 ms 704 KiB
3_max0 AC 19 ms 1020 KiB
3_max1 AC 28 ms 1020 KiB
3_max2 AC 24 ms 1020 KiB
3_max3 AC 27 ms 1020 KiB
3_max4 AC 19 ms 1020 KiB
3_max5 AC 19 ms 1020 KiB
3_max6 AC 24 ms 1020 KiB
3_max7 AC 21 ms 1020 KiB
3_max8 AC 26 ms 1020 KiB
3_max9 AC 22 ms 1020 KiB
5_hand0 AC 1 ms 256 KiB
sample_01 AC 1 ms 256 KiB
sample_02 AC 1 ms 256 KiB
sample_03 AC 1 ms 256 KiB