結果

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

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
No.204 ゴールデン・ウィーク(2)
https://yukicoder.me/problems/no/204

"""
import sys
from sys import stdin
input = stdin.readline


def check_streak(gw, s, D):
    tmp = gw[:]
    for i in range(s, s+D):
        if s+D >= len(gw):
            break
        tmp[i] = 'o'

    ans = 0
    day = 0
    for d in tmp:
        if d == 'o':
            day += 1
        else:
            ans = max(ans, day)
            day = 0
    ans = max(ans, day)
    return ans


def main(args):
    D = int(input())
    gw = list(input().strip())
    gw.extend(list(input().strip()))

    longest_gw = 0
    for s in range(14):
        day_off = check_streak(gw, s, D)
        longest_gw = max(longest_gw, day_off)
    print(longest_gw)


if __name__ == '__main__':
    main(sys.argv[1:])
0