結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー lam6er
提出日時 2025-03-31 17:47:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 853 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 82,616 KB
実行使用メモリ 65,508 KB
最終ジャッジ日時 2025-03-31 17:48:55
合計ジャッジ時間 3,517 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

D = int(input())
C = input().strip() + input().strip()
S = 'x' * D + C + 'x' * D

n = len(S)
max_x = [0] * n

current = 0
for i in reversed(range(n)):
    if S[i] == 'x':
        current += 1
    else:
        current = 0
    max_x[i] = current

max_length = 0

for i in range(n):
    possible_k = min(max_x[i], D)
    if possible_k == 0:
        continue
    for k in range(1, possible_k + 1):
        modified = list(S)
        for j in range(i, i + k):
            modified[j] = 'o'
        current_len = 0
        current_max = 0
        for c in modified:
            if c == 'o':
                current_len += 1
                if current_len > current_max:
                    current_max = current_len
            else:
                current_len = 0
        if current_max > max_length:
            max_length = current_max

print(max_length)
0