結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
|
| 提出日時 | 2018-02-02 20:56:46 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 608 bytes |
| コンパイル時間 | 153 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 24,520 KB |
| 最終ジャッジ日時 | 2024-12-31 06:55:33 |
| 合計ジャッジ時間 | 169,985 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 2 RE * 1 TLE * 27 |
ソースコード
N = 0
dp = []
sushi_list = []
def eat_sushi(index, is_ate):
if index == N:
return 0
if dp[is_ate][index] != -1:
return dp[is_ate][index]
if is_ate == 0:
return max(
eat_sushi(index+1, 1) + sushi_list[index],
eat_sushi(index+1, 0)
)
else:
return eat_sushi(index+1, 0)
def main():
global N
global dp
global sushi_list
N = int(input())
sushi_list = list(map(
int, input().split()
))
for is_ate in range(2):
dp.append([])
for time in range(N):
dp[is_ate].append(-1)
print(max(
eat_sushi(0, 0),
eat_sushi(1, 0)
))
main()