結果
問題 | No.38 赤青白ブロック |
ユーザー |
|
提出日時 | 2016-10-17 15:54:46 |
言語 | PyPy2 (7.3.15) |
結果 |
AC
|
実行時間 | 897 ms / 5,000 ms |
コード長 | 576 bytes |
コンパイル時間 | 512 ms |
コンパイル使用メモリ | 77,076 KB |
実行使用メモリ | 79,104 KB |
最終ジャッジ日時 | 2024-12-23 13:05:34 |
合計ジャッジ時間 | 24,419 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
Kr, Kb = map(int, raw_input().split()) S = raw_input() C = S.count('R') + S.count('B') def solve(b): newS = '' c = -1 for i, s in enumerate(S): if s != 'W': c += 1 if ((1<<c) & 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+Kb] == 'B': return 0 return N ans = S.count('W') for b in xrange(1<<C): ans = max(solve(b), ans) print ans