結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2019-04-19 16:31:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,416 bytes |
| コンパイル時間 | 2,068 ms |
| コンパイル使用メモリ | 208,400 KB |
| 最終ジャッジ日時 | 2025-01-07 02:31:53 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 1 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
//INSERT ABOVE HERE
signed main(){
string str;
map<string, string> ch;
ch["digi"]="nyo";
ch["petit"]="nyu";
ch["rabi"]="";
ch["gema"]="gema";
ch["piyo"]="pyo";
auto YES=[](){cout<<"CORRECT (maybe)\n";};
auto NO=[](){cout<<"WRONG!\n";};
while(getline(cin,str)){
stringstream ss(str);
string name;
ss>>name;
//cout<<name<<endl;
if(!ch.count(name)){
NO();
continue;
}
string tmp=str.substr(name.size());
//cout<<tmp<<endl;
string s;
for(char c:tmp){
if(c==' ') continue;
s+=tolower(c);
}
//cout<<s<<endl;
auto is_symbol=
[](char c){
if(isalpha(c)) return false;
if(isdigit(c)) return false;
return true;
};
int cnt=0;
for(char c:s) cnt+=!is_symbol(c);
if(cnt==0){
NO();
continue;
}
if(name=="rabi"){
YES();
continue;
}
int num=0;
while(is_symbol(s.back())){
num++;
s.pop_back();
}
if(num>3){
NO();
continue;
}
string t=s.substr(max<int>(0,s.size()-ch[name].size()));
if(t==ch[name]) YES();
else NO();
}
cout<<flush;
return 0;
}
beet