結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2022-11-19 01:06:37 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 2,000 ms |
| コード長 | 357 bytes |
| コンパイル時間 | 120 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-20 05:15:30 |
| 合計ジャッジ時間 | 2,256 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
S=input()
ANS=1<<60
for i in range(len(S)):
for j in range(i+1,len(S)+1):
T=S[i:j]
flag=0
for t in T:
if t=="c" and flag==0:
flag+=1
elif t=="w" and flag>=1:
flag+=1
if flag>=3:
ANS=min(ANS,len(T))
if ANS==1<<60:
print(-1)
else:
print(ANS)
titia