結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー gew1fw
提出日時 2025-06-12 16:46:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 82,604 KB
実行使用メモリ 65,332 KB
最終ジャッジ日時 2025-06-12 16:47:50
合計ジャッジ時間 3,530 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

def max_consec_o(s):
    max_len = 0
    current = 0
    for c in s:
        if c == 'o':
            current += 1
            if current > max_len:
                max_len = current
        else:
            current = 0
    return max_len

D = int(input())
C1 = input().strip()
C2 = input().strip()
two_weeks = C1 + C2
extended = 'x' * D + two_weeks + 'x' * D

max_run = max_consec_o(extended)

for K in range(1, D + 1):
    for i in range(len(extended) - K + 1):
        temp = list(extended)
        for j in range(i, i + K):
            if temp[j] == 'x':
                temp[j] = 'o'
        current_max = max_consec_o(''.join(temp))
        if current_max > max_run:
            max_run = current_max

print(max_run)
0