結果
問題 |
No.38 赤青白ブロック
|
ユーザー |
![]() |
提出日時 | 2020-09-09 12:30:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 612 ms / 5,000 ms |
コード長 | 774 bytes |
コンパイル時間 | 253 ms |
コンパイル使用メモリ | 82,748 KB |
実行使用メモリ | 77,020 KB |
最終ジャッジ日時 | 2025-01-01 18:39:38 |
合計ジャッジ時間 | 16,969 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
import sys read=sys.stdin.buffer.read readline=sys.stdin.readline readlines=sys.stdin.buffer.readlines kr, kb=map(int, readline().split()) s=readline().rstrip() ans=0 for i in range(1<<20): t="" cnt=0 for j in range(30): if s[j]=='R': if (i&(1<<cnt))==0: t+='R' cnt+=1 elif s[j]=='B': if (i&(1<<cnt))==0: t+='B' cnt+=1 else: t+='W' if len(t)<ans: continue dame=False for j, c in enumerate(t): if c=='R' and j+kr<len(t) and t[j+kr]=='R': dame=True break elif c=='B' and j+kb<len(t) and t[j+kb]=='B': dame=True break if not dame: ans=len(t) print(ans)