結果
問題 | No.197 手品 |
ユーザー |
![]() |
提出日時 | 2015-05-10 01:25:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,086 bytes |
コンパイル時間 | 681 ms |
コンパイル使用メモリ | 72,292 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 03:39:43 |
合計ジャッジ時間 | 1,712 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
#include <iostream> #include <string> #include <map> using namespace std; int main() { map<string, int> stateGroups; map<string, int> stateIds; stateGroups["xxx"] = 0; stateGroups["xxo"] = 1; stateGroups["xox"] = 1; stateGroups["xoo"] = 2; stateGroups["oxx"] = 1; stateGroups["oxo"] = 2; stateGroups["oox"] = 2; stateGroups["ooo"] = 3; stateIds["xxo"] = 0; stateIds["xox"] = 1; stateIds["xoo"] = 0; stateIds["oxx"] = 2; stateIds["oxo"] = 1; stateIds["oox"] = 2; int minTransitions[3][3] = { 0, 1, 2, 1, 2, 1, 2, 1, 0 }; string sBefore; int n; string sAfter; cin >> sBefore >> n >> sAfter; if (stateGroups[sBefore] != stateGroups[sAfter]) { cout << "SUCCESS" << endl; return 0; } int group = stateGroups[sBefore]; if (group == 0 || group == 3) { cout << "FAILURE" << endl; return 0; } if (stateIds[sBefore] == 1 && stateIds[sAfter] == 1 && n == 0) { cout << "FAILURE" << endl; return 0; } if (n >= minTransitions[stateIds[sBefore]][stateIds[sAfter]]) { cout << "FAILURE" << endl; return 0; } cout << "SUCCESS" << endl; return 0; }