結果
| 問題 | 
                            No.5 数字のブロック
                             | 
                    
| コンテスト | |
| ユーザー | 
                             gya9_
                         | 
                    
| 提出日時 | 2018-07-19 19:20:19 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 427 bytes | 
| コンパイル時間 | 95 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-12-24 07:47:10 | 
| 合計ジャッジ時間 | 2,321 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 34 | 
ソースコード
import sys
S = input()
# S = "ccwwccw"
cpos = [i for i, x in enumerate(S) if x == "c"]
wpos = [i for i, x in enumerate(S) if x == "w"]
ans = []
if len(cpos) == 0 or len(wpos) <= 1:
    print(-1)
    sys.exit()
for i in cpos:
    wpostemp = [j for j in wpos if j > i]
    if len(wpostemp) <= 1:
        break
    anstemp = wpostemp[1] - i + 1
    ans.append(anstemp)
if not ans:
    print(-1)
else:
    print(min(ans))
            
            
            
        
            
gya9_