Submission #3253797


Source Code Expand

/**
 * File    : C.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-9-23 21:07:54
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

set<int> to[26];
set<int> from[26];
string S, T;

int main()
{
  cin >> S >> T;
  int N = S.size();
  for (auto i = 0; i < N; i++)
  {
    int x = S[i] - 'a';
    int y = T[i] - 'a';
    to[x].insert(y);
    from[y].insert(x);
  }
  for (auto i = 0; i < 26; i++)
  {
    if (to[i].size() > 1 || from[i].size() > 1)
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Submission Info

Submission Time
Task C - String Transformation
User kazunetakahashi
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1610 Byte
Status AC
Exec Time 25 ms
Memory 776 KB

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 2 ms 256 KB
0_min1 AC 1 ms 256 KB
1_small0 AC 1 ms 256 KB
1_small1 AC 1 ms 256 KB
1_small2 AC 1 ms 256 KB
2_medium0 AC 20 ms 772 KB
2_medium1 AC 11 ms 772 KB
2_medium2 AC 4 ms 384 KB
2_medium3 AC 14 ms 776 KB
2_medium4 AC 12 ms 772 KB
3_max0 AC 25 ms 776 KB
3_max1 AC 15 ms 776 KB
3_max2 AC 16 ms 776 KB
3_max3 AC 15 ms 776 KB
3_max4 AC 16 ms 776 KB
3_max5 AC 19 ms 776 KB
3_max6 AC 15 ms 776 KB
3_max7 AC 16 ms 776 KB
3_max8 AC 16 ms 776 KB
3_max9 AC 15 ms 776 KB
5_hand0 AC 1 ms 256 KB
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sample_03 AC 1 ms 256 KB