結果

問題 No.380 悪の台本
ユーザー kurenai3110kurenai3110
提出日時 2017-01-31 23:05:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 130 ms / 1,000 ms
コード長 1,010 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-24 14:55:09
合計ジャッジ時間 1,176 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,496 KB
testcase_01 AC 32 ms
10,624 KB
testcase_02 AC 30 ms
10,496 KB
testcase_03 AC 30 ms
10,496 KB
testcase_04 AC 40 ms
10,496 KB
testcase_05 AC 80 ms
10,624 KB
testcase_06 AC 74 ms
10,624 KB
testcase_07 AC 130 ms
10,496 KB
testcase_08 AC 33 ms
10,880 KB
testcase_09 AC 45 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

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[:4:-1]):
            flag=True
    elif solve('petit ',s):
        if solve(pe,s[:5:-1]):
            flag=True
    elif solve('rabi ',s):
        if solve(ra,s[:4:-1]):
            flag=True       
    elif solve('gema ',s):
        if solve(ge,s[:4:-1]):
            flag=True        
    elif solve('piyo ',s):
        if solve(pi,s[:4:-1]):
            flag=True
            
    if flag:
        print(AC)
    else:
        print(WA)
0