結果
問題 |
No.380 悪の台本
|
ユーザー |
![]() |
提出日時 | 2025-04-17 23:40:43 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 135 ms / 1,000 ms |
コード長 | 4,381 bytes |
コンパイル時間 | 3,142 ms |
コンパイル使用メモリ | 283,604 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-17 23:40:48 |
合計ジャッジ時間 | 4,114 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 |
ソースコード
#include<bits/stdc++.h> using namespace std; inline int read(){ int x=0; char c=getchar(); while(c<'0' || c>'9'){ c=getchar(); } while(c>='0' && c<='9'){ x=(x<<1)+(x<<3)+(c^48); c=getchar(); } return x; } signed main(){ // freopen("","r",stdin); // freopen("","w",stdout); string s; while(getline(cin,s)){ stringstream ss(s); vector<string> a; int id=0; if(s.empty() || !(s[0]>='a' && s[0]<='z')){ cout<<"WRONG!\n"; continue; } while(ss>>s){ if(id++){ for(auto &&c:s){ if(c>='A' && c<='Z'){ c^=32; } } } a.emplace_back(s); } if(a.size()<=1){ cout<<"WRONG!\n"; continue; } bool ans=0; if(a[0]=="digi"){ ans|=a.back().substr(max(0,int(a.back().size())-3),3)=="nyo"; for(int i=0;i<3;i++){ if(!a.back().empty() && !isalnum(a.back().back())){ a.back().pop_back(); } if(a.back().empty()){ a.pop_back(); if(a.size()<=1){ break; } } ans|=a.back().substr(max(0,int(a.back().size())-3),3)=="nyo"; } }else if(a[0]=="petit"){ ans|=a.back().substr(max(0,int(a.back().size())-3),3)=="nyu"; for(int i=0;i<3;i++){ if(!a.back().empty() && !isalnum(a.back().back())){ a.back().pop_back(); } if(a.back().empty()){ a.pop_back(); if(a.size()<=1){ break; } } ans|=a.back().substr(max(0,int(a.back().size())-3),3)=="nyu"; } }else if(a[0]=="rabi"){ for(int i=1;i<a.size();i++){ for(auto &&c:a[i]){ if(isalnum(c)){ ans|=1; } } } }else if(a[0]=="gema"){ ans|=a.back().substr(max(0,int(a.back().size())-4),4)=="gema"; for(int i=0;i<3;i++){ if(!a.back().empty() && !isalnum(a.back().back())) a.back().pop_back(); if(a.back().empty()){ a.pop_back(); if(a.size()<=1){ break; } } ans|=a.back().substr(max(0,int(a.back().size())-4),4)=="gema"; } }else if(a[0]=="piyo"){ ans|=a.back().substr(max(0,int(a.back().size())-3),3)=="pyo"; for(int i=0;i<3;i++){ if(!a.back().empty() && !isalnum(a.back().back())){ a.back().pop_back(); } if(a.back().empty()){ a.pop_back(); if(a.size()<=1){ break; } } ans|=a.back().substr(max(0, int(a.back().size())-3),3)=="pyo"; } } cout<<(ans?"CORRECT (maybe)":"WRONG!")<<"\n"; } return 0; } /*?? ?????? ??????????????????????? ???????????????????? ???????????5???????????????????????????????????????????????????????????????????????????????????????????????24????????????????????????????????????????????????????????????????????? ???????????????????? ???????????????????????????????????????????????????????????????????????????????????????????...????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...???????????????????????????????? ?????????????? ???????????? ????????????? ????????????? ????????? ??? ? ?? ? ??????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????? ????????????????????? ???????????????????? ????????????? ???????????????? ???????????????????????? ????????????????????????? ?????? ?????????????? ???????????? ??????????????????? ???????????? ?????? ????? ??????????? ?????????????? ????? ????? ????? ?????? ??????????????? ?????????? ?????????????? ???????????? ????*/