結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-04-05 19:12:36 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,580 bytes |
| コンパイル時間 | 2,259 ms |
| コンパイル使用メモリ | 204,652 KB |
| 最終ジャッジ日時 | 2025-01-09 14:19:57 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 WA * 6 |
ソースコード
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using lubl=long double;
bool issymbol(char c){return std::isgraph(c)&&!std::isalnum(c);}
#define ERR {\
std::cout<<"WRONG!"<<'\n';\
continue;\
}
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
std::map<std::string,std::string>map={
{"digi","nyo"},
{"petit","nyu"},
{"gema","gema"},
{"piyo","pyo"}
};
while(true){
std::string s;std::getline(std::cin,s);
if(s.empty())break;
lint n=s.length();
lint l=0;
for(;l<n&&s.at(l)!=' ';l++);
if(l==n)ERR;
std::string name=s.substr(0,l);
l++;
if(name=="rabi"){
bool found=false;
for(char c:s.substr(l,n-l)){
if(issymbol(c))continue;
found=true;
break;
}
if(!found)ERR
}else {
auto it=map.find(name);
if(it==map.end())ERR;
std::string expected=it->second;
lint r=n;
for(;r&&issymbol(s.at(r-1));r--);
if(r==0||r<l||r<n-3)ERR;
std::string result=s.substr(r-expected.size(),expected.size());
if(!std::all_of(ALL(result),[](char c){return std::isalpha(c);}))ERR
for(char&c:result){
c=std::tolower(c);
}
if(result!=expected)ERR
}
std::cout<<"CORRECT (maybe)"<<'\n';
}
}
ngtkana