結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
rocoder
|
| 提出日時 | 2017-05-13 15:18:22 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 468 bytes |
| 記録 | |
| コンパイル時間 | 500 ms |
| コンパイル使用メモリ | 20,824 KB |
| 実行使用メモリ | 15,360 KB |
| 最終ジャッジ日時 | 2026-04-04 19:42:21 |
| 合計ジャッジ時間 | 4,748 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge5_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 7 |
ソースコード
S=input()
S=list(S)
Ch=[]
W=[]
for i in range(len(S)):
if S[i]=="c":
Ch.append(i)
if S[i]=="w":
W.append(i)
D=[]
if len(W)<2 or len(Ch)<1:
print (-1)
else:
i=0
while i<len(Ch) and Ch[i]<W[len(W)-2]:
e=0
j=1
while e==0 and j<len(W):
if W[j-1]>Ch[i]:
D.append(W[j]-Ch[i]+1)
e=1
j+=1
i+=1
D.sort()
if len(D)>0:
print(D[0])
else:
print (-1)
rocoder