結果
問題 |
No.45 回転寿司
|
ユーザー |
![]() |
提出日時 | 2018-06-04 19:14:29 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 38 ms / 5,000 ms |
コード長 | 566 bytes |
コンパイル時間 | 599 ms |
コンパイル使用メモリ | 12,288 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-12-27 18:59:03 |
合計ジャッジ時間 | 2,673 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
n = int(input()) v = list(map(int, input().split())) que = [[0,True]] #[暫定合計値,次回食べていいか否か] for cnt in range(len(v)): now_que1 = [] now_que2 = [] for now in que: if now[1]: now_que1.append([now[0]+v[cnt],False]) now_que2.append([now[0],True]) else: now_que2.append([now[0],True]) now_que1.sort(key=lambda x: -x[0]) now_que2.sort(key=lambda x: -x[0]) que = [] que.append(now_que1[0]) que.append(now_que2[0]) que.sort(key=lambda x: -x[0]) print(que[0][0])