結果

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

ソースコード

diff #

d = int(input())
C = "o" + "x" * (d + 1) + input() + input() + "x" * (d + 1) + "o"

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)


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