結果

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

ソースコード

diff #

#!/usr/bin/env python3
def takewhile(s, c):
    assert c in 'ox'
    f = {'o':'x', 'x':'o'}
    try:
        return s[:s.index(f[c])]
    except:
        return s
d = int(input())
s = ''
s += input()
s += input()
ans = 0
for i in range(len(s)):
    x = len(takewhile(s[i:], 'o'))
    y = min(d, len(takewhile(s[i+x:], 'x')))
    z = len(takewhile(s[i+x+y:], 'o'))
    ans = max(ans, x + y + z)
print(ans)
0