結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
asi1024
|
| 提出日時 | 2016-03-03 02:50:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 473 bytes |
| コンパイル時間 | 1,202 ms |
| コンパイル使用メモリ | 158,440 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-25 11:35:56 |
| 合計ジャッジ時間 | 2,109 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
const ld eps = 1e-9, pi = acos(-1.0);
int main() {
string str;
cin >> str;
int N = str.size();
int res = 1e9;
REP(i,N) REP(j,i) REP(k,j)
if (str[k] == 'c' && str[j] == 'w' && str[i] == 'w')
res = min(res, i - k + 1);
cout << (res == 1e9 ? -1 : res) << endl;
return 0;
}
asi1024