結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:12:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 122 ms / 1,000 ms |
| コード長 | 1,463 bytes |
| コンパイル時間 | 170 ms |
| コンパイル使用メモリ | 82,420 KB |
| 実行使用メモリ | 77,748 KB |
| 最終ジャッジ日時 | 2025-03-20 21:13:22 |
| 合計ジャッジ時間 | 1,371 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 |
ソースコード
def is_alphanumeric(c):
return c.isalpha() or c.isdigit()
def is_symbol(c):
return not is_alphanumeric(c)
def check_character(name, dialogue):
if name == 'digi':
base = 'nyo'
elif name == 'petit':
base = 'nyu'
elif name == 'gema':
base = 'gema'
elif name == 'piyo':
base = 'pyo'
elif name == 'rabi':
for c in dialogue:
if is_alphanumeric(c):
return True
return False
else:
return False # This case shouldn't happen as name is validated earlier
base_lower = base.lower()
base_len = len(base_lower)
for i in range(0, 4): # Check 0 to 3 symbols after the base
suffix_length = base_len + i
if suffix_length > len(dialogue):
continue
suffix = dialogue[-suffix_length:].lower()
if not suffix.startswith(base_lower):
continue
symbols_part = suffix[len(base_lower):]
if all(is_symbol(c) for c in symbols_part):
return True
return False
import sys
for line in sys.stdin:
line = line.rstrip('\n')
parts = line.split(' ', 1)
if len(parts) != 2 or not parts[1]:
print("WRONG!")
continue
name, dialogue = parts
if name not in {'digi', 'petit', 'rabi', 'gema', 'piyo'}:
print("WRONG!")
continue
if check_character(name, dialogue):
print("CORRECT (maybe)")
else:
print("WRONG!")
lam6er