結果

問題 No.345 最小チワワ問題
ユーザー Takayuki HirotaTakayuki Hirota
提出日時 2021-02-04 14:44:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 264 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 71,624 KB
最終ジャッジ日時 2023-09-13 09:33:57
合計ジャッジ時間 3,828 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,624 KB
testcase_01 AC 71 ms
71,400 KB
testcase_02 AC 71 ms
71,348 KB
testcase_03 AC 70 ms
71,164 KB
testcase_04 AC 74 ms
71,340 KB
testcase_05 AC 70 ms
71,172 KB
testcase_06 AC 71 ms
71,280 KB
testcase_07 AC 70 ms
71,348 KB
testcase_08 AC 71 ms
71,144 KB
testcase_09 AC 70 ms
71,212 KB
testcase_10 AC 71 ms
71,528 KB
testcase_11 AC 70 ms
71,416 KB
testcase_12 AC 71 ms
71,448 KB
testcase_13 AC 70 ms
71,480 KB
testcase_14 AC 70 ms
71,364 KB
testcase_15 AC 70 ms
71,272 KB
testcase_16 AC 70 ms
71,272 KB
testcase_17 AC 71 ms
71,276 KB
testcase_18 AC 71 ms
71,372 KB
testcase_19 AC 71 ms
71,168 KB
testcase_20 AC 69 ms
71,364 KB
testcase_21 AC 71 ms
71,332 KB
testcase_22 AC 69 ms
71,496 KB
testcase_23 AC 69 ms
71,308 KB
testcase_24 AC 70 ms
71,160 KB
testcase_25 AC 71 ms
71,496 KB
testcase_26 AC 70 ms
71,364 KB
testcase_27 AC 69 ms
71,216 KB
testcase_28 AC 71 ms
71,276 KB
testcase_29 AC 70 ms
71,244 KB
testcase_30 AC 71 ms
71,376 KB
testcase_31 AC 71 ms
71,568 KB
権限があれば一括ダウンロードができます

ソースコード

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