結果

問題 No.197 手品
ユーザー oxyshower
提出日時 2020-01-11 22:50:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 742 bytes
コンパイル時間 1,644 ms
コンパイル使用メモリ 177,784 KB
実行使用メモリ 6,816 KB
最終ジャッジ日時 2024-11-26 07:41:05
合計ジャッジ時間 3,012 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 41 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

signed main(){

  string s, t;
  int n;
  cin >> s >> n >> t;

  map<string, int> mp;
  for(int i = 0; i < 1 << 3; i++){
    string str;
    for(int j = 0; j < 3; j++){
      if(i >> j & 1) str += 'o';
      else str += 'x';
    }
    mp[str] = INF;
  }

  function< void(string,int) > rec =
  [&](string s, int k){
    mp[s] = min(mp[s], k);
    if(k > 6) return;
    swap(s[0], s[1]);
    rec(s, k+1);
    swap(s[0], s[1]);
    swap(s[1], s[2]);
    rec(s, k+1);
  };
  rec(s, 0);

  if(mp[t] <= n){
    cout << "FAILURE" << endl;
  }else{
    cout << "SUCCESS" << endl;
  }

  return 0;
}
0