結果
問題 | No.345 最小チワワ問題 |
ユーザー |
|
提出日時 | 2016-02-18 03:07:51 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 387 bytes |
コンパイル時間 | 112 ms |
コンパイル使用メモリ | 7,072 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-25 11:20:12 |
合計ジャッジ時間 | 1,353 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
# -*- coding: utf-8 -*-S = raw_input()hitC = -1hitW = -1mn = float("inf")latestCWStart = -1for i, s in enumerate(S):if s == "c":hitC = iif s == "w":if latestCWStart != -1:mn = min(mn, i - latestCWStart + 1)hitW = iif hitC < hitW:latestCWStart = hitCif mn == float("inf"):print -1else:print mn