結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
oxyshower
|
| 提出日時 | 2020-01-11 22:56:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 825 bytes |
| コンパイル時間 | 1,917 ms |
| コンパイル使用メモリ | 177,412 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-20 03:58:55 |
| 合計ジャッジ時間 | 3,076 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 43 |
ソースコード
#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;
if(n == 0 && s == t){
cout << "FAILURE" << endl;
return 0;
}
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){
if(k > 0) 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;
}
oxyshower