結果

問題 No.380 悪の台本
ユーザー htkbhtkb
提出日時 2019-02-08 11:49:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 225 ms / 1,000 ms
コード長 646 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 10,940 KB
実行使用メモリ 9,820 KB
最終ジャッジ日時 2023-09-09 23:39:45
合計ジャッジ時間 1,747 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
9,200 KB
testcase_01 AC 24 ms
9,084 KB
testcase_02 AC 24 ms
9,240 KB
testcase_03 AC 24 ms
9,024 KB
testcase_04 AC 66 ms
9,072 KB
testcase_05 AC 73 ms
9,224 KB
testcase_06 AC 67 ms
9,200 KB
testcase_07 AC 225 ms
9,028 KB
testcase_08 AC 222 ms
9,820 KB
testcase_09 AC 70 ms
9,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import re
suffix = {"digi": "nyo", "petit": "nyu", "rabi": "", "gema": "gema", "piyo": "pyo"}

for line in sys.stdin:
    converted = ""
    chara = line.split(" ")[0]
    line = line[len(chara)+1:-1]

    for c, kc in zip(line.lower(), (ord(c) for c in line)):
        if not (48 <= kc <= 57 or 65 <= kc <= 90 or 97 <= kc <= 122):
            c = "!"
        converted += c

    if chara in suffix and (
            chara == "rabi" and len(converted) != converted.count("!") or\
            chara != "rabi" and re.search("%s!{0,3}$" % suffix[chara], converted)
    ):
        print("CORRECT (maybe)")
    else:
        print("WRONG!")
0