結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー rpy3cpp
提出日時 2015-05-08 22:39:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 620 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-13 11:34:54
合計ジャッジ時間 2,589 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

def longest_holidays(weeks):
    longest = 0
    x = 0
    for day in weeks:
        if day == 'o':
            x += 1
            if x > longest:
                longest = x
        else:
            x = 0
    return longest

d = int(input())
first_week = input()
second_week = input()
golden_weeks = first_week + second_week
longest = longest_holidays(golden_weeks)
for i in range(14):
    for j in range(i+1, min(i + d, 14) + 1):
        if 'o' not in golden_weeks[i:j]:
            weeks = golden_weeks[:i] + 'o' * (j - i) + golden_weeks[j:]
            longest = max(longest_holidays(weeks), longest)
print(longest)
0