結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-26 19:21:04 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,508 bytes |
| コンパイル時間 | 8,840 ms |
| コンパイル使用メモリ | 268,616 KB |
| 最終ジャッジ日時 | 2025-01-07 15:19:59 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 RE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool issign(char c) {
return !isalpha(c)&&!isdigit(c);
}
string tolowers(string s) {
for (char& c:s)
c=tolower(c);
return s;
}
int main() {
string s;
map<string,string> guys={{"digi","nyo"},{"petit","nyu"},{"rabi",""},{"gema","gema"},{"piyo","pyo"}};
while (getline(cin,s)) {
int n=s.size();
int i=0;
string name;
while (i<n&&s[i]!=' ') {
name+=s[i];
i++;
}
if (guys.find(name)==guys.end()) {
puts("WRONG!");
continue;
}
i++;
s=s.substr(i);
if (name=="rabi") {
bool f=0;
for (char c:s) {
if (isalpha(c)||isdigit(c)) {
f=1;
break;
}
}
if (f) puts("CORRECT (maybe)");
else puts("WRONG!");
continue;
}
int r=s.size();
r--;
int cnt=0;
while (0<=r&&issign(s[r])) {
cnt++;
r--;
}
if (cnt>3) {
puts("WRONG!");
continue;
}
string suf=guys[name];
int l=r-suf.size()+1;
if (l<0) {
puts("WRONG!");
continue;
}
if (tolowers(s.substr(l,suf.size()))==suf) {
puts("CORRECT (maybe)");
} else {
puts("WRONG!");
}
}
return 0;
}