結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-04-20 17:05:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 133 ms / 1,000 ms |
| コード長 | 1,157 bytes |
| コンパイル時間 | 2,012 ms |
| コンパイル使用メモリ | 167,188 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-20 17:05:34 |
| 合計ジャッジ時間 | 2,765 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
inline bool f(char c){return !isalnum(c);}inline bool g(const string& s,const string& t,int l){int n=s.size();if(n<l)return 0;for(int i=0;i<=n-l;++i){string sub=s.substr(i,l);transform(sub.begin(),sub.end(),sub.begin(),::tolower);if(sub!=t)continue;int r=n-(i+l);if(r<0||r>3)continue;bool ok=1;for(int j=i+l;j<n;++j)if(!f(s[j])){ok=0;break;}if(ok)return 1;}return 0;}inline bool h(const string& s){for(char c:s)if(!f(c))return 1;return 0;}vector<string>n={"digi","petit","rabi","gema","piyo"};
signed main(){
// freopen("dialogue.in","r",stdin);
// freopen("dialogue.out","w",stdout);
string l;
while(getline(cin,l)){
size_t p=l.find(' ');
if(p==string::npos){cout<<"WRONG!\n";continue;}
string nm=l.substr(0,p);
string c=l.substr(p+1);
if(c.empty()||find(n.begin(),n.end(),nm)==n.end()){
puts("WRONG!");continue;
}bool cor=0;
if(nm=="digi")cor=g(c,"nyo",3);
else if(nm=="petit")cor=g(c,"nyu",3);
else if(nm=="rabi")cor=h(c);
else if(nm=="gema")cor=g(c,"gema",4);
else if(nm=="piyo")cor=g(c,"pyo",3);
puts(cor?"CORRECT (maybe)":"WRONG!");
}
}
vjudge1