結果

問題 No.197 手品
ユーザー a01sa01to
提出日時 2025-06-26 00:36:07
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 863 bytes
コンパイル時間 3,051 ms
コンパイル使用メモリ 276,588 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-06-26 00:36:12
合計ジャッジ時間 4,902 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  string s, t;
  int n;
  cin >> s >> n >> t;
  int cnts = 0, cntt = 0;
  for (char c : s) cnts += (c == 'o');
  for (char c : t) cntt += (c == 'o');
  if (cnts != cntt) {
    cout << "SUCCESS" << '\n';
  }
  else if (n == 0 && s != t) {
    cout << "SUCCESS" << '\n';
  }
  else if (n == 1) {
    bool ok = true;
    swap(s[0], s[1]);
    if (s == t) ok = false;
    swap(s[0], s[1]);
    swap(s[1], s[2]);
    if (s == t) ok = false;
    swap(s[1], s[2]);
    cout << (ok ? "SUCCESS" : "FAILURE") << '\n';
  }
  else {
    cout << "FAILURE" << '\n';
  }
  return 0;
}
0