結果

問題 No.380 悪の台本
ユーザー しらっ亭しらっ亭
提出日時 2016-06-18 00:44:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 89 ms / 1,000 ms
コード長 751 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 10,072 KB
最終ジャッジ日時 2023-08-06 19:47:50
合計ジャッジ時間 1,156 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
9,184 KB
testcase_01 AC 26 ms
9,236 KB
testcase_02 AC 27 ms
9,276 KB
testcase_03 AC 25 ms
9,092 KB
testcase_04 AC 29 ms
9,280 KB
testcase_05 AC 43 ms
9,260 KB
testcase_06 AC 37 ms
9,256 KB
testcase_07 AC 89 ms
9,120 KB
testcase_08 AC 28 ms
10,072 KB
testcase_09 AC 32 ms
9,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import re
import sys

re_digi = r'nyo[^a-z0-9]{0,3}$'
re_petit = r'nyu[^a-z0-9]{0,3}$'
re_rabi = r'[a-z0-9]'
re_gema = r'gema[^a-z0-9]{0,3}$'
re_piyo = r'pyo[^a-z0-9]{0,3}$'

name_re = {'digi': re_digi, 'petit': re_petit, 'rabi': re_rabi, 'gema': re_gema, 'piyo': re_piyo}


def check(text):
    if len(text) == 0:
        return False
    name = text.split(' ', -1)[0]
    text = text.lower()
    if name not in name_re:
        return False
    pat = name_re[name]
    serif = text[len(name):]
    #print(name, serif, pat)
    return re.search(pat, serif)


def solve():
    for l in sys.stdin:
        if check(l.rstrip('\n')):
            print('CORRECT (maybe)')
        else:
            print('WRONG!')


if __name__ == '__main__':
    solve()
0