結果
問題 | No.38 赤青白ブロック |
ユーザー |
![]() |
提出日時 | 2020-12-17 02:22:31 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,175 ms / 5,000 ms |
コード長 | 1,195 bytes |
コンパイル時間 | 235 ms |
コンパイル使用メモリ | 82,052 KB |
実行使用メモリ | 76,648 KB |
最終ジャッジ日時 | 2024-09-20 06:03:54 |
合計ジャッジ時間 | 29,279 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) r,b = MI() S = S() X = [] for i in range(30): if S[i] != 'W': X.append(i) ans = 10 for i in range(1<<20): delete = [] for j in range(20): if (i>>j) & 1: delete.append(X[j]) delete.append(100) A = '' index = 0 for j in range(30): if j != delete[index]: A += S[j] else: index += 1 l = len(A) for j in range(l): if A[j] == 'W': continue elif A[j] == 'R': if (0 <= j-r and A[j-r] == 'R') or (j+r < l and A[j+r] == 'R'): break else: if (0 <= j-b and A[j-b] == 'B') or (j+b < l and A[j+b] == 'B'): break else: ans = max(ans,l) print(ans)