結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-26 22:27:26 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 398 bytes |
| 記録 | |
| コンパイル時間 | 134 ms |
| コンパイル使用メモリ | 77,688 KB |
| 最終ジャッジ日時 | 2025-12-03 19:31:05 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 RE * 3 |
ソースコード
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll
s = raw_input()
c = []
w = []
for i, si in enumerate(s):
if si == "c":
c.append(i)
if si == "w":
w.append(i)
ans = 200
for i in c:
j = bisect.bisect_right(w, i)
if j == len(w) - 1: break
ans = min(ans, w[j + 1] - i + 1)
print ans if ans < 200 else -1