結果
| 問題 | No.345 最小チワワ問題 |
| ユーザー |
|
| 提出日時 | 2026-11-09 06:37:21 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 623 bytes |
| 記録 | |
| コンパイル時間 | 2,342 ms |
| コンパイル使用メモリ | 336,500 KB |
| 実行使用メモリ | 9,932 KB |
| 最終ジャッジ日時 | 2026-11-09 06:37:27 |
| 合計ジャッジ時間 | 4,859 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 17 |
ソースコード
#include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
using i128 = __int128;
void solve() {
std::string s; std::cin >> s;
int N = s.size();
int max = -1, Z = 0, a = 0;
for(int i = 0; i < N; i ++) {
if(Z == 0 && s[i] == 'c') {
Z ++;
a = i;
}
if(Z > 0 && s[i] == 'w') Z ++;
if(Z == 3) {
max = std::max(max, i - a + 1);
Z = 0;
}
}
std::cout << max;
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int T = 1;
//std::cin >> T;
while (T--) {
solve();
}
return 0;
}