結果
| 問題 | No.204 ゴールデン・ウィーク(2) |
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 16:43:59 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 712 bytes |
| 記録 | |
| コンパイル時間 | 223 ms |
| コンパイル使用メモリ | 95,980 KB |
| 実行使用メモリ | 78,848 KB |
| 最終ジャッジ日時 | 2026-07-11 17:18:51 |
| 合計ジャッジ時間 | 5,568 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 WA * 6 |
ソースコード
D = int(input())
line1 = input().strip()
line2 = input().strip()
mid = line1 + line2
pre = 'x' * (D + 1)
post = 'x' * (D + 1)
timeline = pre + mid + post
def max_consecutive(s):
current = 0
max_o = 0
for c in s:
if c == 'o':
current += 1
if current > max_o:
max_o = current
else:
current = 0
return max_o
max_result = 0
for i in range(len(timeline) - D + 1):
substring = timeline[i:i+D]
if all(c == 'x' for c in substring):
new_s = timeline[:i] + 'o' * D + timeline[i+D:]
current_max = max_consecutive(new_s)
if current_max > max_result:
max_result = current_max
print(max_result)
gew1fw