結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2016-02-27 02:52:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 346 bytes |
コンパイル時間 | 1,441 ms |
コンパイル使用メモリ | 159,340 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-25 11:28:24 |
合計ジャッジ時間 | 2,436 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; }