結果
問題 | No.197 手品 |
ユーザー |
![]() |
提出日時 | 2015-04-29 00:37:07 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 980 bytes |
コンパイル時間 | 589 ms |
コンパイル使用メモリ | 74,040 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-27 08:27:25 |
合計ジャッジ時間 | 1,758 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 41 WA * 2 |
ソースコード
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <queue> #include <stack> #include <set> #include <map> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <numeric> #define rep(x, to) for (int x = 0; x < (to); x++) #define REP(x, a, to) for (int x = (a); x < (to); x++) #define foreach(itr, x) for (typeof((x).begin()) itr = (x).begin(); itr != (x).end(); itr++) using namespace std; typedef long long ll; typedef pair<int, int> PII; typedef pair<long, long> PLL; ll N; string s,t; bool is_success(string x, int d) { bool res = true; if (d == 0) { //cout << x << endl; return x != t; } swap(x[0], x[1]); res &= is_success(x, d - 1); swap(x[0], x[1]); swap(x[1], x[2]); res &= is_success(x, d - 1); swap(x[1], x[2]); return res; } int main() { cin >> s; cin >> N; cin >> t; if (is_success(s, N % 6)) { cout << "SUCCESS" << endl; } else { cout << "FAILURE" << endl; } return 0; }