結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
P₋boy
|
| 提出日時 | 2024-05-10 15:53:09 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 317µs | |
| コード長 | 472 bytes |
| 記録 | |
| コンパイル時間 | 1,023 ms |
| コンパイル使用メモリ | 213,936 KB |
| 実行使用メモリ | 9,904 KB |
| 最終ジャッジ日時 | 2026-10-11 00:42:40 |
| 合計ジャッジ時間 | 2,666 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
string S; cin >> S;
int N = S.size();
int ans = 109;
for(int i = 0; i < N - 2; ++i){
for(int j = i + 1; j < N - 1; ++j){
for(int k = j + 1; k < N; ++k){
if(S[i] == 'c'&&S[j] == 'w'&&S[k] == 'w'){
ans = min(ans, k - i + 1);
}
}
}
}
if(ans == 109) cout << -1 << endl;
else cout << ans << endl;
}
P₋boy