結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
![]() |
提出日時 | 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 |
ソースコード
D = int(input())C = input()C = C + input()N = []H = []f = 0for c in C:if f == 0:if c == "x":continueelse:f = 1cnt = 1elif f == 1:if c == "o":cnt += 1else:H.append(cnt)f = 2cnt = 1elif f == 2:if c == "x":cnt += 1else:N.append((cnt))f = 1cnt = 1if f == 1:H.append(cnt)ans = 0if 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)