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