結果
問題 |
No.380 悪の台本
|
ユーザー |
![]() |
提出日時 | 2025-04-17 23:50:23 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,206 bytes |
コンパイル時間 | 4,062 ms |
コンパイル使用メモリ | 286,744 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-04-17 23:50:28 |
合計ジャッジ時間 | 4,755 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 6 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long #define NO { cout << "WRONG!\n"; continue; } #define YES { cout << "CORRECT (maybe)\n"; continue; } string st; bool check(char c) { return !isdigit(c) && !isalpha(c); } signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); map<string, string> mp; mp["digi"] = "nyo", mp["petit"] = "nyu", mp["gema"] = "gema", mp["piyo"] = "pyo"; while (getline(cin, st) && st != "") { // cout << "st: \"" << st << "\"\n"; int pos = -1; for (int i = (int)st.size() - 1; i >= 0; i -- ) if (st[i] == ' ') pos = i; if (pos == -1) NO string name = st.substr(0, pos); string s = st.substr(pos + 1, (int)st.size() - pos); int cnt = 0; while (s.size() && check(s.back())) cnt ++ , s.pop_back(); if (cnt > 3) NO // cout << "name: \"" << name << "\"\n"; // cout << "s: \"" << s << "\"\n"; if (name == "rabi") { int cnt = 0; for (auto i : s) if (!check(i)) cnt = 1; if (cnt) YES else NO } else if (mp.count(name)) { for (auto& i : s) i = tolower(i); if (s.size() >= mp[name].size() && s.substr((int)s.size() - mp[name].size(), mp[name].size()) == mp[name]) YES else NO } else NO } return 0; }