結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 16:47:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 983 bytes |
| コンパイル時間 | 153 ms |
| コンパイル使用メモリ | 82,620 KB |
| 実行使用メモリ | 54,192 KB |
| 最終ジャッジ日時 | 2025-06-12 16:47:53 |
| 合計ジャッジ時間 | 3,217 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 31 |
ソースコード
D = int(input())
c1 = input().strip()
c2 = input().strip()
arr = list(c1 + c2)
max_original = 0
current = 0
for c in arr:
if c == 'o':
current += 1
if current > max_original:
max_original = current
else:
current = 0
if D == 0:
print(max_original)
exit()
max_total = 0
for i in range(0, 14 - D + 1):
valid = True
for j in range(i, i + D):
if j >= 14 or arr[j] != 'x':
valid = False
break
if valid:
left = 0
if i > 0:
pos = i - 1
while pos >= 0 and arr[pos] == 'o':
left += 1
pos -= 1
right = 0
if i + D < 14:
pos = i + D
while pos < 14 and arr[pos] == 'o':
right += 1
pos += 1
total = left + D + right
if total > max_total:
max_total = total
result = max(max_original, max_total)
print(result)
gew1fw