結果
| 問題 |
No.2854 -1 Subsequence
|
| コンテスト | |
| ユーザー |
わん
|
| 提出日時 | 2024-09-01 14:08:25 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 264 bytes |
| コンパイル時間 | 455 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 34,808 KB |
| 最終ジャッジ日時 | 2024-09-01 14:08:39 |
| 合計ジャッジ時間 | 13,522 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 WA * 10 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
INF = float('inf')
s = [0, -INF, -INF, -INF]
for a in A:
ns = s[:]
ns[0] = max(s[0], s[2])
ns[1] = max(s[1], s[3])
ns[2] = max(s[1] + a, s[3] + a)
ns[3] = max(s[0] - a, s[2] - a)
s = ns
print(max(s))
わん