結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2020-10-06 22:18:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 444 bytes |
| コンパイル時間 | 1,677 ms |
| コンパイル使用メモリ | 168,340 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-20 03:03:59 |
| 合計ジャッジ時間 | 2,883 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 12 WA * 17 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
int main() {
string S; cin >> S;
int N = S.size();
int ans = N + 1;
rep(i, N) rep(j, i) rep(k, i)
if (S[i] == 'w') if (S[j] == 'w') if (S[k] == 'c')
ans = min(ans, i - k + 1);
if (ans == N + 1) cout << "-1" << endl;
else cout << ans << endl;
return 0;
}
Nachia