結果
| 問題 |
No.38 赤青白ブロック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-01 10:53:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,198 ms / 5,000 ms |
| コード長 | 664 bytes |
| コンパイル時間 | 258 ms |
| コンパイル使用メモリ | 81,968 KB |
| 実行使用メモリ | 76,956 KB |
| 最終ジャッジ日時 | 2024-10-09 22:18:04 |
| 合計ジャッジ時間 | 33,557 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
ソースコード
Kr,Kb = map(int,input().split())
S = input()
ans = 0
for i in range(1<<20):
lis = []
R,B = divmod(i,1<<10)
r = 0
b = 0
for s in S:
if s == "W":
lis.append(s)
if s == "R":
if R >> r & 1:
lis.append(s)
r += 1
if s == "B":
if B >> b & 1:
lis.append(s)
b += 1
ok = 1
for i,s in enumerate(lis):
if s == "B" and i >= Kb and lis[i-Kb] == "B":
ok = 0
if s == "R" and i >= Kr and lis[i-Kr] == "R":
ok = 0
if ok:
ans = max(ans,len(lis))
print(ans)