結果
| 問題 |
No.258 回転寿司(2)
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-09-28 12:32:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 394 bytes |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 82,208 KB |
| 実行使用メモリ | 55,324 KB |
| 最終ジャッジ日時 | 2024-07-21 07:11:38 |
| 合計ジャッジ時間 | 5,889 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 WA * 47 |
ソースコード
N = int(input())
V = list(map(int, input().split()))
inf = 10 ** 18
dp0 = [-inf] * (N + 1)
dp1 = [-inf] * (N + 1)
dp0[0] = 0
for i in range(N):
dp1[i + 1] = dp0[i] + V[i]
dp0[i + 1] = max(dp0[i], dp1[i])
now = dp1[-1]
print(now)
ans = []
for i in range(N, 0, -1):
if now == dp1[i] and now == dp0[i - 1] + V[i - 1]:
ans.append(i)
now -= V[i - 1]
print(*sorted(ans))
rlangevin