結果
| 問題 | 
                            No.345 最小チワワ問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             めうめう🎒
                         | 
                    
| 提出日時 | 2016-03-13 21:26:44 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 699 bytes | 
| コンパイル時間 | 883 ms | 
| コンパイル使用メモリ | 73,404 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-25 11:23:13 | 
| 合計ジャッジ時間 | 1,514 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 WA * 20 | 
コンパイルメッセージ
main.cpp: In function ‘int bfs(int, int)’:
main.cpp:22:1: warning: no return statement in function returning non-void [-Wreturn-type]
   22 | }
      | ^
            
            ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)
string str;
int bfs(int now,int how){
	int a,b;
}
int main() {
	cin >> str;
	int ans = INF;
	for(int i = 0;i < str.size();i++){
		if(str[i] == 'c'){
			int how = 0;
			for(int j = 0;j < str.size();j++){
				if(str[j] == 'w') how++;
				if(how == 2) {
					ans = min(ans,j-i+1);
					break;
				}
			}
		}
	}
	//cout << INF << endl;
	if(ans == INF) cout << "-1" << endl;
	else cout << ans << endl;
	return 0;
}
            
            
            
        
            
めうめう🎒