結果

問題 No.2629 A replace B replace C
ユーザー ramdosramdos
提出日時 2024-02-16 21:37:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 2,522 bytes
コンパイル時間 4,494 ms
コンパイル使用メモリ 264,828 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-16 21:37:52
合計ジャッジ時間 6,570 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,676 KB
testcase_01 AC 4 ms
6,676 KB
testcase_02 AC 3 ms
6,676 KB
testcase_03 AC 5 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 3 ms
6,676 KB
testcase_06 AC 3 ms
6,676 KB
testcase_07 AC 3 ms
6,676 KB
testcase_08 AC 3 ms
6,676 KB
testcase_09 AC 4 ms
6,676 KB
testcase_10 AC 3 ms
6,676 KB
testcase_11 AC 4 ms
6,676 KB
testcase_12 AC 4 ms
6,676 KB
testcase_13 AC 3 ms
6,676 KB
testcase_14 AC 3 ms
6,676 KB
testcase_15 AC 4 ms
6,676 KB
testcase_16 AC 3 ms
6,676 KB
testcase_17 AC 3 ms
6,676 KB
testcase_18 AC 4 ms
6,676 KB
testcase_19 AC 3 ms
6,676 KB
testcase_20 AC 3 ms
6,676 KB
testcase_21 AC 4 ms
6,676 KB
testcase_22 AC 3 ms
6,676 KB
testcase_23 AC 3 ms
6,676 KB
testcase_24 AC 3 ms
6,676 KB
testcase_25 AC 3 ms
6,676 KB
testcase_26 AC 3 ms
6,676 KB
testcase_27 AC 3 ms
6,676 KB
testcase_28 AC 3 ms
6,676 KB
testcase_29 AC 3 ms
6,676 KB
testcase_30 AC 3 ms
6,676 KB
testcase_31 AC 5 ms
6,676 KB
testcase_32 AC 4 ms
6,676 KB
testcase_33 AC 5 ms
6,676 KB
testcase_34 AC 3 ms
6,676 KB
testcase_35 AC 4 ms
6,676 KB
testcase_36 AC 4 ms
6,676 KB
testcase_37 AC 4 ms
6,676 KB
testcase_38 AC 4 ms
6,676 KB
testcase_39 AC 3 ms
6,676 KB
testcase_40 AC 4 ms
6,676 KB
testcase_41 AC 3 ms
6,676 KB
testcase_42 AC 4 ms
6,676 KB
testcase_43 AC 3 ms
6,676 KB
testcase_44 AC 3 ms
6,676 KB
testcase_45 AC 4 ms
6,676 KB
testcase_46 AC 4 ms
6,676 KB
testcase_47 AC 3 ms
6,676 KB
testcase_48 AC 3 ms
6,676 KB
testcase_49 AC 3 ms
6,676 KB
testcase_50 AC 3 ms
6,676 KB
testcase_51 AC 3 ms
6,676 KB
testcase_52 AC 3 ms
6,676 KB
testcase_53 AC 2 ms
6,676 KB
testcase_54 AC 2 ms
6,676 KB
testcase_55 AC 3 ms
6,676 KB
testcase_56 AC 2 ms
6,676 KB
testcase_57 AC 3 ms
6,676 KB
testcase_58 AC 3 ms
6,676 KB
testcase_59 AC 4 ms
6,676 KB
testcase_60 AC 3 ms
6,676 KB
testcase_61 AC 2 ms
6,676 KB
testcase_62 AC 2 ms
6,676 KB
testcase_63 AC 2 ms
6,676 KB
testcase_64 AC 2 ms
6,676 KB
testcase_65 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma region おまじないα ver1 .08
//#define _CRT_SECURE_NO_WARNINGS
//#pragma warning(disable : 4996)
// using mint = modint1000000007;
// using mint = modint998244353;
#pragma region 変化しないおまじない
#include "bits/stdc++.h"
#if __has_include("atcoder/all")
#include <atcoder/all>
using namespace atcoder;
#endif
#ifdef ONLINE_JUDGE
#pragma GCC optimize("O3")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif
using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()    // sortなどの引数を省略
#define max3(x, y, z) max(x, max(y, z))  // 3変数max
#define min3(x, y, z) min(x, min(y, z))  // 3変数min
#define chmin(m, v) m = min((m), (v))    //最小値を更新
#define chmax(m, v) m = max((m), (v))    //最大値を更新
#define rep(i, n) repi(i, 0, n)          // 0-N rep
#define reps(i, n) repi(i, 1, n + 1)     // 1-N
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); i++)  // a-b
#define prif(x)    \
  if (x) {         \
    cout << "Yes"; \
  } else {         \
    cout << "No";  \
  }
#define P pair<ll, ll>  // typedefだと予測が効かないっぽい?
#ifdef _MSC_FULL_VER    //手元なら
#define dout cout
#else
#define dout \
  if (false) cout
#endif
double dist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
ll idist(ll x1, ll y1, ll x2, ll y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
ll digitsum(ll N) {
  while (N >= 10) {
    int tmp = 0;
    while (N > 0) {
      tmp += (N % 10);
      N /= 10;
    }
    N = tmp;
  }
  return N;
}
struct qwqw {
  qwqw() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} aaaaaaa;
#pragma endregion
#pragma endregion
signed main() {
  ll N;
  cin >> N;
  string S, T;
  cin >> S >> T;
  ll ab = 0;
  ll ac = 0;
  ll bc = 0;
  ll f = 0;
  rep(i, N) {
    if (S[i] == 'A' and T[i] == 'B') ab++;
    if (S[i] == 'A' and T[i] == 'C') ac++;
    if (S[i] == 'B' and T[i] == 'A') f++;
    if (S[i] == 'B' and T[i] == 'C') bc++;
    if (S[i] == 'C' and T[i] == 'A') f++;
    if (S[i] == 'C' and T[i] == 'B') f++;
  }
  if (f != 0) {
    cout << "No" << endl;
    return 0;
  }
  if (bc == 0) {
    if (ab + ac != 0) {
      cout << "No" << endl;
      return 0;
    } else {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (ab == bc) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
0