A17 - Dungeon 2
提出
code: python
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
# 0 1 2 3 4
# 2---4---1---3
# 5---3---3
select = []
for i in range(2, n):
select.append("a")
else:
select.append("b")
print(dp)
print(select)
解答
code: python
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
# 0 1 2 3 4
# 2---4---1---3
# 5---3---3
for i in range(2, n):
# print(dp)
# 答えの復元
# 変数 now は現在位置(ゴールから進んでいく)
# now: 4 → 3 → 1 → 0
ans = []
now = n-1
while True:
ans.append(now)
if now == 0:
break
# どこから部屋 now に向かうのが最適かを答え合わせ的に求める
now = now - 1
# now = now - 2
else:
now = now - 2
ans.reverse()
print(len(ans))
print(" ".join(ans2))
提出
code: python
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
# 1 2 3 4 5
# 2 4 1 3
# 5 3 3
# どっち選んだか保存しておく
selected = []
for i in range(3, n+1):
selected.append("a")
else:
selected.append("b")
# それぞれの時点で何選んだかでは再現できない