結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
kunio_Yb
|
| 提出日時 | 2016-02-27 02:52:15 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 453µs | |
| コード長 | 346 bytes |
| 記録 | |
| コンパイル時間 | 1,102 ms |
| コンパイル使用メモリ | 178,020 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-09-04 01:54:21 |
| 合計ジャッジ時間 | 2,888 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
string str;
cin>>str;
size_t ans=-1; //max of size_t
for(auto ci=str.begin(), e=str.end(); e!=(ci=find(ci,e,'c')); ++ci){
auto wi1=find(ci,e,'w');
if(wi1!=e){
auto wi2=find(++wi1,e,'w');
if(wi2!=e) ans=min(ans,size_t(wi2-ci+1));
}
}
cout << (int)ans;
}
kunio_Yb