結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
|
| 提出日時 | 2018-12-02 01:46:25 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 560 bytes |
| コンパイル時間 | 329 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-06-27 06:07:47 |
| 合計ジャッジ時間 | 3,386 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 RE * 14 |
ソースコード
def memorize(f):
cache = {}
def helper(x, y):
if (x, y) not in cache:
cache[(x, y)] = f(x, y)
return cache[(x, y)]
return helper
memo = {}
@memorize
def kaitenzusi(susi_number,before_get):
if susi_number == N:
return 0
not_get = 0
if before_get == False:
not_get = kaitenzusi(susi_number+1, True) + V[susi_number]
get = kaitenzusi(susi_number+1, False)
return not_get if not_get > get else get
N = int(input())
V = [int(num) for num in input().split()]
print(kaitenzusi(0, False))