結果
問題 |
No.38 赤青白ブロック
|
ユーザー |
![]() |
提出日時 | 2019-03-02 22:43:29 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 619 bytes |
コンパイル時間 | 380 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 52,480 KB |
最終ジャッジ日時 | 2024-06-23 13:01:32 |
合計ジャッジ時間 | 2,241 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 26 |
ソースコード
KR,KB = list(map(int, input().split(' '))) S = input() def meet(s): yes = True length = len(s) for i in range(len(s)): if s[i] == 'R': if (i+KR < length and s[i+KR] == 'R') or (0 <= i-KR and s[i-KR] == 'R'): yes = False elif s[i] == 'B': if (i+KB < length and s[i+KB] == 'R') or (0 <= i-KB and s[i-KB] == 'B'): yes = False return yes def solve(m,s): if meet(s): return len(s) for i in range(len(s)): if s[i] == 'R' or s[i] == 'B': return max(m, solve(m, s[:i] + s[i+1:])) print(solve(-1,S))