結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー maguroguma
提出日時 2017-08-21 16:26:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 1,179 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-10-15 00:51:59
合計ジャッジ時間 2,988 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

'''
問題の解釈がうまくできないのでやめる(好きではない問題だった)
'''

D = int(input())
C = input()
C += input()

maru = batsu = 0
weekday = True
cont_list = []
for c in C:
    if weekday and c=='o':
        maru += 1
    elif weekday and c=='x':
        cont_list.append(maru)
        batsu = 1
        weekday = False
    elif not weekday and c=='x':
        batsu += 1
    elif not weekday and c=='o':
        cont_list.append(batsu)
        maru = 1
        weekday = True
if weekday:
    cont_list.append(maru)
else:
    cont_list.append(batsu)

ans = 0
for i in range(1, len(cont_list), 2):
    if D >= cont_list[i]:
        diff = D - cont_list[i]
        if cont_list[i-1]==0 and i+1<len(cont_list):
            ans = max(ans, diff+cont_list[i]+cont_list[i+1])
        elif i+1<len(cont_list):
            ans = max(ans, cont_list[i-1]+cont_list[i]+cont_list[i+1])
        else:
            ans = max(ans, cont_list[i-1]+cont_list[i]+diff)
    else:
        if i+1<len(cont_list):
            ans = max(ans, cont_list[i-1]+D, D+cont_list[i+1])
        else:
            ans = max(ans, cont_list[i-1]+D)

print(ans)
0