結果

問題 No.345 最小チワワ問題
ユーザー Takayuki HirotaTakayuki Hirota
提出日時 2021-02-04 14:42:56
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 258 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 80,384 KB
最終ジャッジ日時 2023-09-13 09:29:50
合計ジャッジ時間 4,971 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,280 KB
testcase_01 AC 73 ms
71,312 KB
testcase_02 AC 75 ms
71,288 KB
testcase_03 AC 73 ms
71,416 KB
testcase_04 AC 74 ms
71,520 KB
testcase_05 AC 75 ms
71,448 KB
testcase_06 AC 74 ms
71,192 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 74 ms
71,492 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 74 ms
71,476 KB
testcase_15 AC 75 ms
71,332 KB
testcase_16 AC 74 ms
71,560 KB
testcase_17 AC 73 ms
71,472 KB
testcase_18 AC 74 ms
71,340 KB
testcase_19 AC 74 ms
71,532 KB
testcase_20 AC 74 ms
71,300 KB
testcase_21 AC 74 ms
71,332 KB
testcase_22 AC 73 ms
71,272 KB
testcase_23 AC 74 ms
71,352 KB
testcase_24 AC 75 ms
71,536 KB
testcase_25 AC 73 ms
71,376 KB
testcase_26 AC 74 ms
71,308 KB
testcase_27 AC 73 ms
71,224 KB
testcase_28 AC 73 ms
71,484 KB
testcase_29 AC 74 ms
71,292 KB
testcase_30 AC 75 ms
71,196 KB
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

s=input()
if any([s.count('c')<1,s.count('w')<2]):
	print(-1)
else:
	C=[i for i,v in enumerate(s) if v=='c']
	W=[i for i,v in enumerate(s) if v=='w']
m=1000
for c in C:
	tW=[i for i in W if c<i]
	if len(tW)>1:
		m=min(m,tW[1]-c+1)
print(-1 if m==1000 else m)
0