結果
問題 |
No.996 Phnom Penh
|
ユーザー |
![]() |
提出日時 | 2025-04-15 21:27:09 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 912 bytes |
コンパイル時間 | 217 ms |
コンパイル使用メモリ | 82,088 KB |
実行使用メモリ | 251,088 KB |
最終ジャッジ日時 | 2025-04-15 21:31:03 |
合計ジャッジ時間 | 4,207 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 MLE * 1 -- * 14 |
ソースコード
S = input().strip() count = 0 # Apply Operation 1 as much as possible initially while True: new_S = S.replace("phnom", "penh", 1) if new_S != S: count += 1 S = new_S else: break prev_count = -1 # Keep applying operations until no more changes while count != prev_count: prev_count = count # Apply Operation 2 steps op2_applied = False while True: # Apply Operation 2 once new_S = S.replace('h', '') new_S = new_S.replace('e', 'h') if new_S != S: count += 1 S = new_S op2_applied = True else: break # After each Operation 2, check for Operation 1 while True: new_S_op1 = S.replace("phnom", "penh", 1) if new_S_op1 != S: count += 1 S = new_S_op1 else: break print(count)