結果
| 問題 | No.38 赤青白ブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-28 02:56:50 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 579 bytes |
| 記録 | |
| コンパイル時間 | 4,574 ms |
| コンパイル使用メモリ | 279,068 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-28 02:56:58 |
| 合計ジャッジ時間 | 6,111 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 WA * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int Kr, Kb;
cin >> Kr >> Kb;
string S;
cin >> S;
auto dfs = [&](auto &&dfs, string s, int i) ->int {
if(i == 30) return s.size();
if(S[i] == 'W') return dfs(dfs, s + 'W', i + 1);
int ans = dfs(dfs, s, i + 1);
if(S[i] == 'R' and s.size() - Kr >= 0 and s[s.size() - Kr] != 'R') ans = max(ans, dfs(dfs, s + 'R', i + 1));
if(S[i] == 'B' and s.size() - Kb >= 0 and s[s.size() - Kb] != 'B') ans = max(ans, dfs(dfs, s + 'B', i + 1));
return ans;
};
cout << dfs(dfs, "", 0) << endl;
return 0;
}