結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-12 14:56:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 1,000 ms |
| コード長 | 730 bytes |
| コンパイル時間 | 1,031 ms |
| コンパイル使用メモリ | 74,344 KB |
| 最終ジャッジ日時 | 2025-01-09 17:42:20 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 43 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
void fail() {
std::cout << "FAILURE" << std::endl;
std::exit(0);
}
void succ() {
std::cout << "SUCCESS" << std::endl;
std::exit(0);
}
void solve() {
std::string s, t;
int n;
std::cin >> s >> n >> t;
if ((std::count(s.begin(), s.end(), 'o') !=
std::count(t.begin(), t.end(), 'o')) ||
(n == 0 && s != t)) succ();
if (n != 1) fail();
for (int i = 0; i < 2; ++i) {
std::swap(s[i], s[i + 1]);
if (s == t) fail();
std::swap(s[i], s[i + 1]);
}
succ();
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}