結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
kbys
|
| 提出日時 | 2020-07-19 20:26:31 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,269 bytes |
| コンパイル時間 | 387 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-12-16 10:20:05 |
| 合計ジャッジ時間 | 2,912 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 WA * 15 |
ソースコード
d = int(input())
a = list(input())
b = list(input())
week = a+b
schedule = []
now = 0
for w in week:
if w == "o":
if now > 0:
now += 1
else:
schedule.append(now)
now = 1
else:
if now < 0:
now -= 1
else:
schedule.append(now)
now = -1
schedule.append(now)
schedule = schedule[1:]
ans = 0
for i,v in enumerate(schedule):
if v > 0:
continue
else:
if abs(v) <= d:
tmp = abs(v)
try:
tmp += schedule[i-1]
except IndexError:
continue
try:
tmp += schedule[i+1]
except IndexError:
continue
ans = max(ans, tmp)
else:
tmp = d
try:
tmp += schedule[i-1]
except IndexError:
continue
ans = max(ans, tmp)
tmp = d
try:
tmp += schedule[i+1]
except IndexError:
continue
ans = max(ans, tmp)
if not ans:
ans = d
if schedule[0] > 0:
ans = max(ans, d+schedule[0])
if schedule[-1] > 0:
ans = max(ans, d+schedule[-1])
print(ans)
kbys