結果
問題 |
No.45 回転寿司
|
ユーザー |
|
提出日時 | 2018-11-02 11:06:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 517 bytes |
コンパイル時間 | 283 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 33,536 KB |
最終ジャッジ日時 | 2024-11-20 12:25:24 |
合計ジャッジ時間 | 103,807 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 TLE * 12 |
ソースコード
from collections import deque N = int(input()) sushi = [ int(i) for i in input().split() ] sushi.insert(0,0) res = [0] * (N + 1) q = deque([]) res[0] = 0 q.append(0) taboo = False while q: pos = q.popleft() for next_pos in range(pos+1,N+1): if taboo: if next_pos == pos + 1: continue if res[next_pos] < res[pos] + sushi[next_pos]: q.append(next_pos) res[next_pos] = res[pos] + sushi[next_pos] taboo = True print(max(res))