結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー ntuda
提出日時 2024-05-30 22:03:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 670 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 82,100 KB
実行使用メモリ 53,296 KB
最終ジャッジ日時 2024-12-20 21:38:57
合計ジャッジ時間 3,711 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

D = int(input())
C = input()
C = C + input()
N = []
H = []

f = 0
for c in C:
    if f == 0:
        if c == "x":
            continue
        else:
            f = 1
            cnt = 1
    elif f == 1:
        if c == "o":
            cnt += 1
        else:
            H.append(cnt)
            f = 2
            cnt = 1
    elif f == 2:
        if c == "x":
            cnt += 1
        else:
            N.append((cnt))
            f = 1
            cnt = 1
if f == 1:
    H.append(cnt)
ans = 0
if len(H) == 0:
    print(D)
    exit()
ans = max(H[0] + D,H[-1] + D)

for i in range(len(N)):
    if N[i] <= D:
        ans = max(ans, H[i] + N[i] + H[i + 1])
print(ans)
0