結果

問題 No.380 悪の台本
ユーザー not_522not_522
提出日時 2016-12-16 02:07:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,306 bytes
コンパイル時間 1,817 ms
コンパイル使用メモリ 178,724 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 14:52:28
合計ジャッジ時間 3,188 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 135 ms
5,376 KB
testcase_08 WA -
testcase_09 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  map<string, string> m;
  m["digi"] = "nyo";
  m["petit"] = "nyu";
  m["gema"] = "gema";
  m["piyo"] = "pyo";
  string line, name;
  while (getline(cin, line)) {
    stringstream ss(line);
    ss >> name;
    if (line == name || !isalpha(line[0])) {
      cout << "WRONG!" << endl;
      continue;
    }
    line = line.substr(name.size() + 1);
    if (name == "rabi") {
      if (find_if(line.begin(), line.end(), [](char c){return !isalnum(c);}) != line.end()) {
        cout << "WRONG!" << endl;
      } else {
        cout << "CORRECT (maybe)" << endl;
      }
    } else {
      if (!m.count(name)) {
        cout << "WRONG!" << endl;
        continue;
      }
      for (char& c : line) c = tolower(c);
      reverse(line.begin(), line.end());
      int cnt = find_if(line.begin(), line.end(), [](char c){return isalnum(c);}) - line.begin();
      reverse(line.begin(), line.end());
      if (cnt <= 3 && m[name] == line.substr(line.size() - cnt - m[name].size(), m[name].size())) {
        cout << "CORRECT (maybe)" << endl;
      } else {
        cout << "WRONG!" << endl;
      }
    }
  }
}
0