結果

問題 No.380 悪の台本
ユーザー vjudge1
提出日時 2025-04-17 23:46:35
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,168 bytes
コンパイル時間 3,776 ms
コンパイル使用メモリ 287,520 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-17 23:46:40
合計ジャッジ時間 4,183 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define NO { cout << "WRONG!\n"; }
#define YES { cout << "CORRECT (maybe)\n"; }
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();
//		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;
} 
0