結果
問題 | No.38 赤青白ブロック |
ユーザー | dango |
提出日時 | 2023-07-09 16:00:08 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,718 ms / 5,000 ms |
コード長 | 1,023 bytes |
コンパイル時間 | 446 ms |
コンパイル使用メモリ | 86,836 KB |
実行使用メモリ | 78,280 KB |
最終ジャッジ日時 | 2023-09-30 19:22:42 |
合計ジャッジ時間 | 45,592 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,508 ms
77,808 KB |
testcase_01 | AC | 1,661 ms
77,420 KB |
testcase_02 | AC | 1,603 ms
77,672 KB |
testcase_03 | AC | 1,656 ms
77,604 KB |
testcase_04 | AC | 1,572 ms
78,124 KB |
testcase_05 | AC | 1,512 ms
78,280 KB |
testcase_06 | AC | 1,603 ms
77,328 KB |
testcase_07 | AC | 1,645 ms
77,704 KB |
testcase_08 | AC | 1,464 ms
78,028 KB |
testcase_09 | AC | 1,555 ms
77,720 KB |
testcase_10 | AC | 1,459 ms
77,304 KB |
testcase_11 | AC | 1,472 ms
77,824 KB |
testcase_12 | AC | 1,521 ms
77,720 KB |
testcase_13 | AC | 1,472 ms
77,984 KB |
testcase_14 | AC | 1,601 ms
77,876 KB |
testcase_15 | AC | 1,524 ms
77,776 KB |
testcase_16 | AC | 1,595 ms
77,888 KB |
testcase_17 | AC | 1,571 ms
77,304 KB |
testcase_18 | AC | 1,512 ms
78,040 KB |
testcase_19 | AC | 1,512 ms
77,580 KB |
testcase_20 | AC | 1,604 ms
77,660 KB |
testcase_21 | AC | 1,637 ms
77,712 KB |
testcase_22 | AC | 1,569 ms
77,664 KB |
testcase_23 | AC | 1,560 ms
78,192 KB |
testcase_24 | AC | 1,718 ms
77,868 KB |
testcase_25 | AC | 1,571 ms
78,052 KB |
testcase_26 | AC | 1,509 ms
77,740 KB |
ソースコード
import math mmi, mma = math.inf, max bls, brs = lambda x, y: x << y, lambda x, y: x >> y kr, kb = map(int, input().split()) s = input() red, blue = [], [] t = {} use = {} for i in range(1, 31): use[i] = True t[i] = s[i - 1] if t[i] == "R": red.append(i) elif t[i] == "B": blue.append(i) ret = 10 tot = bls(1, 20) for i in range(tot): ti = i for j in range(1, 11): tgt = red[j - 1] use[tgt] = ti % 2 == 1 ti = brs(ti, 1) for j in range(1, 11): tgt = blue[j - 1] use[tgt] = ti % 2 == 1 ti = brs(ti, 1) w = [] for j in range(1, 31): if use[j]: w.append(t[j]) valid = True for j in range(1, len(w) - kr + 1): if w[j - 1] == "R" and w[j + kr - 1] == "R": valid = False break for j in range(1, len(w) - kb + 1): if w[j - 1] == "B" and w[j + kb - 1] == "B": valid = False break if valid: ret = mma(ret, len(w)) print(ret)