結果

問題 No.380 悪の台本
ユーザー maspymaspy
提出日時 2020-02-26 13:28:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,017 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-04-21 16:21:28
合計ジャッジ時間 1,504 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


# %%
query = readlines()


# %%
def end_with_word_plus_symbols(S, word):
    i = S.rfind(word)
    if i < 0 or i < len(S) - 3 - len(word):
        return False
    T = S[i + len(word):]
    return all(not x.isalnum() for x in T)


# %%
def is_ok(S, chara):
    S = S.lower()
    if chara == 'digi':
        return end_with_word_plus_symbols(S, 'nyo')
    if chara == 'petit':
        return end_with_word_plus_symbols(S, 'nyu')
    if chara == 'gema':
        return end_with_word_plus_symbols(S, 'gema')
    if chara == 'piyo':
        return end_with_word_plus_symbols(S, 'pyo')
    if chara == 'rabi':
        return not S.isalnum()
    return False


# %%
for line in query:
    S = line.decode().rstrip()
    words = S.split()
    chara = words[0]
    S = ''.join(words[1:])
    if is_ok(S, chara):
        print('CORRECT (maybe)')
    else:
        print('WRONG!')
0