結果

問題 No.197 手品
ユーザー izryt(趣味)
提出日時 2016-01-19 04:33:08
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 476 bytes
コンパイル時間 1,650 ms
コンパイル使用メモリ 168,436 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-27 13:15:53
合計ジャッジ時間 2,811 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 26 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

map<string, bool> m[5];
string S;
int N;

void rec(string s, int i)
{
    if (i == min(N, 5)) return;

    swap(s[0], s[1]);
    m[i][s] = true;
    rec(s, i + 1);
    swap(s[0], s[1]);

    swap(s[1], s[2]);
    m[i][s] = true;
    rec(s, i + 1);
    swap(s[1], s[2]);
}

int main()
{
    cin >> S;
    m[0][S] = true;
    cin >> N;
    rec(S, 0);
    cin >> S;

    cout << (m[min(N,3)][S] ? "FAILURE" : "SUCCESS") << endl;
}
0