結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
aka_satana_ha
|
| 提出日時 | 2017-11-29 05:14:25 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 5,000 ms |
| コード長 | 558 bytes |
| コンパイル時間 | 154 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-12-27 17:39:52 |
| 合計ジャッジ時間 | 2,257 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
N=int(input())
V=[int(i) for i in input().split()]
#最大値
dp=[[0 for i in range(N)] for j in range(2)]
dp[0][0]=V[0]
dp[1][0]=0
# print(dp)
for i in range(1,N):
dp[0][i]=dp[1][i-1]+V[i]
dp[1][i]=max(dp[0][i-1],dp[1][i-1])
max_value=max(dp[0][N-1],dp[1][N-1])
print(max_value)
#経路探索
# take=0 if dp[0][N-1]>dp[1][N-1] else 1
# path=[]
# for i in reversed(range(N)):
# if take==0:
# path.insert(0,True)
# take=1
# else:
# path.insert(0,False)
# take=0 if dp[0][i-1]>dp[1][i-1] else 1
# print(path)
aka_satana_ha