結果
| 問題 |
No.38 赤青白ブロック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-17 15:28:33 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 517 bytes |
| コンパイル時間 | 1,029 ms |
| コンパイル使用メモリ | 77,056 KB |
| 実行使用メモリ | 78,848 KB |
| 最終ジャッジ日時 | 2024-11-22 13:15:57 |
| 合計ジャッジ時間 | 10,957 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 6 RE * 16 |
ソースコード
Kr, Kb = map(int, raw_input().split())
S = raw_input()
C = S.count('R') + S.count('B')
def solve(b):
newS = ''
for i, s in enumerate(S):
if s != 'W' and (1<<i & b):
continue
newS += s
N = len(newS)
for i in xrange(N-Kr):
if newS[i] == 'R' and newS[i+Kr] == 'R':
return 0
for i in xrange(N-Kb):
if newS[i] == 'B' and newS[i+Kr] == 'B':
return 0
return N
ans = 0
for b in xrange(1<<C):
ans = max(solve(b), ans)
print ans