結果
問題 | No.380 悪の台本 |
ユーザー | 0w1 |
提出日時 | 2016-11-29 16:14:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,165 bytes |
コンパイル時間 | 1,767 ms |
コンパイル使用メモリ | 172,948 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-06 23:17:44 |
合計ジャッジ時間 | 2,355 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
ソースコード
#include <bits/stdc++.h> using namespace std; const string msg[] = { "WRONG!", "CORRECT(maybe)" }; const string pn[] = { "digi", "petit", "rabi", "gema", "piyo" }; signed main(){ string buff; while( getline( cin, buff ) ){ assert( buff[ 0 ] != ' ' ); stringstream ss( buff ); string s; int p = 0; string name; int ng = 0; while( ss >> s ){ if( p == 0 ){ name = s; int ok = 0; for( int i = 0; i < 5; ++i ) ok |= name == pn[ i ]; ng |= not ok; break; } ++p; } for( int i = 0; i < buff.size(); ++i ) if( 'A' <= buff[ i ] and buff[ i ] <= 'Z' ) buff[ i ] = buff[ i ] - 'A' + 'a'; if( name.empty() ) cout << msg[ 0 ] << endl, exit( 0 ); string z = buff.substr( name.size() ); if( name == pn[ 0 ] ){ // string z = buff; int ok = 0; for( int i = 0; i + 3 <= z.size(); ++i ) if( z.substr( i, 3 ) == "nyo" ) ok |= ( int ) z.size() - ( i + 3 ) <= 2; ng |= not ok; } else if( name == pn[ 1 ] ){ // string z; // for( int i = 0; i < dict.size(); ++i ) // z += dict[ i ]; int ok = 0; for( int i = 0; i + 3 <= z.size(); ++i ) if( z.substr( i, 3 ) == "nyu" ) ok |= ( int ) z.size() - ( i + 3 ) <= 2; ng |= not ok; } else if( name == pn[ 2 ] ){ // string z; // for( int i = 0; i < dict.size(); ++i ) int ok = 0; for( int i = 0; i < z.size(); ++i ) ok |= 'a' <= z[ i ] and z[ i ] <= 'z', ok |= 'A' <= z[ i ] and z[ i ] <= 'z', ok |= '0' <= z[ i ] and z[ i ] <= '9'; ng |= not ok; } else if( name == pn[ 3 ] ){ int ok = 0; for( int i = 0; i + 4 <= z.size(); ++i ) if( z.substr( i, 4 ) == "gema" ) ok |= ( int ) z.size() - ( i + 3 ) <= 2; ng |= not ok; } else if( name == pn[ 4 ] ){ int ok = 0; for( int i = 0; i + 3 <= z.size(); ++i ) if( z.substr( i, 3 ) == "pyo" ) ok |= ( int ) z.size() - ( i + 3 ) <= 2; ng |= not ok; } cout << msg[ not name.empty() and not ng ] << endl; } return 0; }