結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
|
| 提出日時 | 2018-02-02 21:00:03 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 645 bytes |
| コンパイル時間 | 312 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 24,904 KB |
| 最終ジャッジ日時 | 2024-12-31 06:59:14 |
| 合計ジャッジ時間 | 169,877 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 2 RE * 1 TLE * 27 |
ソースコード
import array
N = None
dp = []
sushi_list = None
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 = array.array("Q", 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()