結果

問題 No.380 悪の台本
ユーザー kurenai3110kurenai3110
提出日時 2017-01-31 22:59:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,003 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-24 14:55:06
合計ジャッジ時間 1,284 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 32 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 41 ms
10,752 KB
testcase_05 AC 81 ms
10,752 KB
testcase_06 AC 77 ms
10,752 KB
testcase_07 AC 134 ms
10,752 KB
testcase_08 AC 34 ms
11,136 KB
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import re

di = re.compile(r'\n[^a-zA-Z0-9]{0,3}(o|O)(y|Y)(n|N)')
pe = re.compile(r'\n[^a-zA-Z0-9]{0,3}(u|U)(y|Y)(n|N)')
ra = re.compile(r'\n.*[a-zA-Z0-9]+.* ')
ge = re.compile(r'\n[^a-zA-Z0-9]{0,3}(a|A)(m|M)(e|E)(g|G)')
pi = re.compile(r'\n[^a-zA-Z0-9]{0,3}(o|O)(y|Y)(p|P)')

AC='CORRECT (maybe)'
WA='WRONG!'

def solve(pattern,s):
    if re.match(pattern,s):
        return True
    return False

for s in sys.stdin:
    words = s.split()
    if len(words)<=1:
        print(WA)
        continue

    flag = False
    if solve('digi',s):
        if solve(di,s[::-1]):
            flag=True
    elif solve('petit',s):
        if solve(pe,s[::-1]):
            flag=True
    elif solve('rabi',s):
        if solve(ra,s[::-1]):
            flag=True       
    elif solve('gema',s):
        if solve(ge,s[::-1]):
            flag=True        
    elif solve('piyo',s):
        if solve(pi,s[::-1]):
            flag=True
            
    if flag:
        print(AC)
    else:
        print(WA)
0