結果

問題 No.380 悪の台本
ユーザー t98slidert98slider
提出日時 2023-07-16 20:13:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,135 bytes
コンパイル時間 1,756 ms
コンパイル使用メモリ 176,928 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 18:02:18
合計ジャッジ時間 2,436 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 26 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string str;
    while(getline(cin, str)){
        stringstream ss(str);
        vector<string> a;
        int id = 0;
        while(ss >> str){
            if(id++) for(auto &&c : str) if(isupper(c)) c ^= 32;
            a.emplace_back(str);
        }
        if(a.empty()){
            cout << "WRONG!\n";
            continue;
        }
        bool ans = false;
        int siz = a.back().size();
        if(a[0] == "digi"){
            ans |= a.back().substr(max(0, siz - 3), 3) == "nyo";
            for(int i = 0; i < 3; i++){
                if(!a.back().empty() && !isalpha(a.back().back())) a.back().pop_back(), siz--;
                ans |= a.back().substr(max(0, siz - 3), 3) == "nyo";
            }
        }else if(a[0] == "petit"){
            ans |= a.back().substr(max(0, siz - 3), 3) == "nyu";
            for(int i = 0; i < 3; i++){
                if(!a.back().empty() && !isalpha(a.back().back())) a.back().pop_back(), siz--;
                ans |= a.back().substr(max(0, siz - 3), 3) == "nyu";
            }
        }else if(a[0] == "rabi"){
            for(int i = 1; i < a.size(); i++){
                for(auto &&c : a[i]){
                    if(isalpha(c)) ans |= true;
                    if('0' <= c && c <= '9') ans |= true;
                }
            }
        }else if(a[0] == "gema"){
            ans |= a.back().substr(max(0, siz - 4), 4) == "gema";
            for(int i = 0; i < 3; i++){
                if(!a.back().empty() && !isalpha(a.back().back())) a.back().pop_back(), siz--;
                ans |= a.back().substr(max(0, siz - 4), 4) == "gema";
            }
        }else if(a[0] == "piyo"){
            ans |= a.back().substr(max(0, siz - 3), 3) == "pyo";
            for(int i = 0; i < 3; i++){
                if(!a.back().empty() && !isalpha(a.back().back())) a.back().pop_back(), siz--;
                ans |= a.back().substr(max(0, siz - 3), 3) == "pyo";
            }
        }
        cout << (ans ? "CORRECT (maybe)" : "WRONG!") << '\n';
    }
}
0