結果

問題 No.380 悪の台本
ユーザー ngtkanangtkana
提出日時 2020-04-05 19:10:37
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,539 bytes
コンパイル時間 2,264 ms
コンパイル使用メモリ 209,492 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 23:52:24
合計ジャッジ時間 2,626 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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());
            for(char&c:result){
                if(!std::isalpha(c))ERR
                c=std::tolower(c);
            }
            if(result!=expected)ERR
        }
        std::cout<<"CORRECT (maybe)"<<'\n';
    }
}
0