結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー lam6er
提出日時 2025-04-16 01:16:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 731 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 82,840 KB
実行使用メモリ 59,312 KB
最終ジャッジ日時 2025-04-16 01:16:56
合計ジャッジ時間 3,158 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

D = int(input())
week1 = input().strip()
week2 = input().strip()
original = week1 + week2

pre = 'x' * D
post = 'x' * D
S = pre + original + post

max_result = 0

for i in range(len(S)):
    cnt = 0
    j = i
    while j < len(S) and cnt < D and S[j] == 'x':
        cnt += 1
        j += 1
    end = i + cnt - 1
    if cnt == 0:
        continue
    modified = list(S)
    for k in range(i, end + 1):
        modified[k] = 'o'
    current_max = 0
    current = 0
    for c in modified:
        if c == 'o':
            current += 1
            if current > current_max:
                current_max = current
        else:
            current = 0
    if current_max > max_result:
        max_result = current_max

print(max_result)
0