結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
ohana
|
| 提出日時 | 2023-10-23 17:35:26 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
AC
|
| 実行時間 | 71 ms / 2,000 ms |
| + 532µs | |
| コード長 | 422 bytes |
| 記録 | |
| コンパイル時間 | 568 ms |
| コンパイル使用メモリ | 95,952 KB |
| 実行使用メモリ | 83,712 KB |
| 最終ジャッジ日時 | 2026-09-02 10:32:21 |
| 合計ジャッジ時間 | 4,460 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
from collections import deque
s = input()
dq = deque()
cww = deque()
mn = float("inf")
for c in s:
for i in range(len(dq)):
dq[i] += 1
if c == "c":
dq.append(1)
cww.append(0)
if c == "w":
for i in range(len(dq)):
cww[i] += 1
while cww and cww[0] == 2:
cww.popleft()
mn = min(mn, dq.popleft())
print(mn if mn != float("inf") else -1)
ohana