結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-29 00:29:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 712 bytes |
| コンパイル時間 | 477 ms |
| コンパイル使用メモリ | 56,540 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-20 03:35:55 |
| 合計ジャッジ時間 | 1,767 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 43 |
ソースコード
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main() {
long long n;
string s1, s2;
cin >> s1 >> n >> s2;
int n1 = 0, n2 = 0;
for (int i = 0; i < s1.size(); i++) {
if (s1[i] == 'o') {
n1++;
}
if (s2[i] == 'o') {
n2++;
}
}
if (n1 != n2) {
cout << "SUCCESS" << endl;
return 0;
}
if (n >= 3) {
cout << "FAILURE" << endl;
return 0;
}
for (int i = 0; i < 8; i++) {
auto ss = s1;
if(n > 0) { swap(ss[(i & 1) ? 0 : 2], ss[1]); }
if(n > 1) { swap(ss[(i & 2) ? 0 : 2], ss[1]); }
if(n > 2) { swap(ss[(i & 4) ? 0 : 2], ss[1]); }
if (ss == s2) {
cout << "FAILURE" << endl;
return 0;
}
}
cout << "SUCCESS" << endl;
return 0;
}