結果

問題 No.345 最小チワワ問題
コンテスト
ユーザー keisuke6
提出日時 2022-08-17 11:03:51
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 417µs
コード長 320 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,305 ms
コンパイル使用メモリ 210,040 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2026-10-11 00:08:12
合計ジャッジ時間 2,803 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int ans = 10000;
  string S;
  cin>>S;
  int N = S.size();
  for(int i=0;i<N;i++)for(int j=i+1;j<N;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});
  cout<<ans-(ans==10000)*10001<<endl;
}
0