結果

問題 No.204 ゴールデン・ウィーク(2)
コンテスト
ユーザー koheijkt
提出日時 2026-04-23 09:36:08
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 472 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 251 ms
コンパイル使用メモリ 85,156 KB
実行使用メモリ 55,596 KB
最終ジャッジ日時 2026-04-23 09:36:13
合計ジャッジ時間 3,913 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import deque
D = int(input())
c1 = input()
c2 = input()
C = c1 + c2
que = deque()

cntx = 0
ans = 0
for c in C:
    que.append(c)
    if c == 'x':
        cntx += 1

    # que の中にある x が D 以下になるようにする
    while cntx > D:
        rm = que.popleft()
        if rm == 'x':
            cntx -= 1
    
    # c が右端にあるときの最適な形になった
    sub = len(que)

    if sub > ans:
        ans = sub

print(ans)
0