結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー gew1fw
提出日時 2025-06-12 21:42:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 582 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 81,708 KB
実行使用メモリ 53,800 KB
最終ジャッジ日時 2025-06-12 21:46:07
合計ジャッジ時間 4,094 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

D = int(input())
line1 = input().strip()
line2 = input().strip()

original = line1 + line2
extended = 'x' * D + original + 'x' * D

max_streak = 0
n = len(extended)

for i in range(n - D + 1):
    substr = extended[i:i+D]
    if substr.count('x') != D:
        continue
    new_str = extended[:i] + 'o' * D + extended[i+D:]
    current = 0
    max_current = 0
    for c in new_str:
        if c == 'o':
            current += 1
            max_current = max(max_current, current)
        else:
            current = 0
    max_streak = max(max_streak, max_current)

print(max_streak)
0