結果
問題 |
No.380 悪の台本
|
ユーザー |
![]() |
提出日時 | 2020-02-26 13:31:21 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,073 bytes |
コンパイル時間 | 83 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-10-13 15:17:46 |
合計ジャッジ時間 | 865 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 2 WA * 4 RE * 2 |
ソースコード
#!/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): if S[0] == ' ': return False words = S.split() if not words: return False chara = words[0] S = ''.join(words[1:]).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() if is_ok(S): print('CORRECT (maybe)') else: print('WRONG!')