結果
問題 | No.197 手品 |
ユーザー |
|
提出日時 | 2015-04-29 17:20:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 632 bytes |
コンパイル時間 | 1,538 ms |
コンパイル使用メモリ | 168,416 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 03:36:43 |
合計ジャッジ時間 | 2,845 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ string S; cin >> S; int N; cin >> N; set<string> stock; stock.insert(S); for(int i=0;i<N;i++){ set<string> newStk; for(string x : stock){ string nx = x; swap(nx[0], nx[1]); newStk.insert(nx); nx = x; swap(nx[1], nx[2]); newStk.insert(nx); } if(stock == newStk) break; stock = newStk; } string T; cin >> T; cout << (stock.count(T) != 0 ? "FAILURE" : "SUCCESS") << endl; return 0; }