結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー rin204
提出日時 2022-01-20 08:19:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 429 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-11-23 14:21:25
合計ジャッジ時間 3,716 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

d = int(input())
C = input() + input()

bef = "o"
lst = []
cnt = 0
for c in C:
    if c != bef:
        lst.append(cnt)
        cnt = 1
        bef = c
    else:
        cnt += 1

lst.append(cnt)
if bef == "x":
    lst.append(0)

l = len(lst)
ans = 0
for i in range(1, l, 2):
    if lst[i] <= d:
        ans = max(ans, lst[i - 1] + lst[i] + lst[i + 1])
    else:
        ans = max(ans, max(lst[i - 1], lst[i + 1]) + d)
print(ans)
0